1. 查看linux的內核版本,系統信息,經常使用的有三種辦法:php
uname -a; cat /proc/version;python
-bash-4.2$ uname -a Linux apphost 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
-bash-4.2$ cat /proc/version Linux version 3.10.0-514.26.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 15:04:05 UTC 2017
2. 查看apache的版本信息,若是是經過yum,或者是rpm安裝的,可使用rpm -qa |gerp httpd 來查看;mysql
-bash-4.2$ rpm -qa | grep httpd httpd-2.4.6-80.el7.centos.x86_64 httpd-tools-2.4.6-80.el7.centos.x86_64
還能夠經過httpd -v來查詢;linux
-bash-4.2$ httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Apr 20 2018 18:10:38
3.查看php的版本信息,若是是經過yum,或者是rpm包安裝的,可使用rpm -qa |grep php來查看;sql
-bash-4.2$ rpm -qa | grep php php-common-5.4.16-42.el7.x86_64 php-5.4.16-42.el7.x86_64 php-cli-5.4.16-42.el7.x86_64 php-gd-5.4.16-42.el7.x86_64 php-devel-5.4.16-42.el7.x86_64 php-pdo-5.4.16-42.el7.x86_64 php-mbstring-5.4.16-42.el7.x86_64 php-process-5.4.16-42.el7.x86_64 php-mcrypt-5.4.16-7.el7.x86_64 php-mysqlnd-5.4.16-42.el7.x86_64
一樣,也可使用php -v來查看php的版本信息;apache
-bash-4.2$ php -v PHP Warning: Module 'pcntl' already loaded in Unknown on line 0 PHP 5.4.16 (cli) (built: Nov 6 2016 00:29:02) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
4. 查看mysql的版本信息,若是是經過yum安裝的,或者是rpm包安裝的,可使用rpm -qa |grep mysql 來查看;centos
-bash-4.2$ rpm -qa | grep mysql mysql-community-server-5.7.19-1.el7.x86_64 mysql-connector-python-2.1.7-1.el7.x86_64 mysql-utilities-1.6.5-1.el7.noarch mysql-community-client-5.7.19-1.el7.x86_64 mysql-community-libs-compat-5.7.19-1.el7.x86_64 mysql-community-common-5.7.19-1.el7.x86_64 mysql-community-libs-5.7.19-1.el7.x86_64 mysql57-community-release-el7-10.noarch php-mysqlnd-5.4.16-42.el7.x86_64
也可使用mysql -vbash
-bash-4.2$ mysql -V mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper
也能夠進入mysql,而後經過命令status來查看;app
-bash-4.2$ mysql -utangbing -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4764 Server version: 5.7.19 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> status; -------------- mysql Ver 14.14 Distrib 5.7.19, for Linux (x86_64) using EditLine wrapper Connection id: 4764 Current database: Current user: tangbing@localhost SSL: Not in use Current pager: stdout Using outfile: '' Using delimiter: ; Server version: 5.7.19 MySQL Community Server (GPL) Protocol version: 10 Connection: Localhost via UNIX socket Server characterset: latin1 Db characterset: latin1 Client characterset: utf8 Conn. characterset: utf8 UNIX socket: /var/lib/mysql/mysql.sock Uptime: 2 days 6 hours 14 min 34 sec Threads: 4 Questions: 279544 Slow queries: 0 Opens: 13870 Flush tables: 1 Open tables: 1871 Queries per second avg: 1.431 --------------