服务器那些事儿
查看信息
Linux下查看系统信息
# uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
-i, --hardware-platform print the hardware platform (non-portable)
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit
# uname -s 核心
Linux
root@iZbp1hxtmn3a1etzuczekrZ:/# uname -n 网络节点主机名称
iZbp1hxtmn3a1etzuczekrZ
# uname -r 内核发行版
4.4.0-146-generic
# uname -v 内核版本
#172-Ubuntu SMP Wed Apr 3 09:00:08 UTC 2019
# uname -m 机器硬件名称
x86_64
# uname -p 处理器类型
x86_64
# uname -i 硬件平台
x86_64
# uname -o 操作系统
GNU/Linux
查看内核版本、系统信息(常用三种办法)
# uname -a
Linux iZbp1hxtmn3a1etzuczekrZ 4.4.0-146-generic #172-Ubuntu SMP Wed Apr 3 09:00:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
root@iZbp1hxtmn3a1etzuczekrZ:/# more /etc/issue
Ubuntu 16.04.6 LTS \n \l
# more /proc/version
Linux version 4.4.0-146-generic (buildd@lcy01-amd64-025) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10) ) #172-Ubuntu SMP Wed Apr 3
09:00:08 UTC 2019
# cat /proc/version
Linux version 4.4.0-146-generic (buildd@lcy01-amd64-025) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10) ) #172-Ubuntu SMP Wed Apr 3 09:00:08 UTC 2019
查看apache2
# apache2 -version
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2019-04-03T13:34:47
# apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2019-04-03T13:34:47
查看php
# php -version
PHP 7.0.33-0ubuntu0.16.04.5 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-0ubuntu0.16.04.5, Copyright (c) 1999-2017, by Zend Technologies
# php -v
PHP 7.0.33-0ubuntu0.16.04.5 (cli) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-0ubuntu0.16.04.5, Copyright (c) 1999-2017, by Zend Technologies
查看Mysql
注意:V大写
# mysql -V
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
# mysql -Version
mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper
查看redis
# redis-server --version
Redis server v=3.0.6 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=28b6715d3583bf8e
# redis-cli -v
redis-cli 3.0.6
安装
Ubuntu 下安装redis
$sudo apt-get update
$sudo apt-get install redis-server
清屏
第一种:
# clear
第二种
ctrl+l(键盘操作)
以上命令会刷新屏幕,本质上只是让终端显示页向后翻了一页,如果向上滚动屏幕还可以看到之前的操作信息
第三种:
# reset
该命令将完全刷新终端屏幕,之前的终端输入操作信息将都会被清空