01 Linux系统管理
1.查看系统信息
-
查看版本信息
# 1.查看系统内核信息 uname -a #Linux shell.testing-studio.com 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 # 2.查看发行版本信息 lsb_release -a #LSB Version: :core-4.1-amd64:core-4.1-noarch #Distributor ID: CentOS #Description: CentOS Linux release 7.3.1611 (Core) #Release: 7.3.1611 #Codename: Core cat /etc/xxx-release #如centos-release #CentOS Linux release 7.3.1611 (Core) cat /etc/issue cat /etc/os-release cat /proc/version
-
查看当前登陆用户
# 1. 查看当前登陆的用户 w # 10:18:20 up 178 days, 12:33, 2 users, load average: 0.02, 0.16, 0.47 #USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT #hogwarts pts/0 113.106.11.61 09:37 4.00s 0.06s 0.00s w #26918773 pts/1 116.237.12.217 Tue14 12:26m 0.21s 0.18s -bash who #需要root权限 users #19429701 26918773 hogwarts2019 whoami #hogwarts2019 id #uid=1632(hogwarts2019) gid=1633(hogwarts2019) groups=1633(hogwarts2019) last [user] #显示特定用户登陆系统历史记录,如果没有指定任何参数,则打印所有用户的信息,读取的是/var/log/wtmp lastlog #查看所有用户最后一次登陆信息
-
查看shell中历史命令
history
-
查看当前系统支持的shell种类
more /etc/shells
-
查看系统所有的用户
cat /etc/passwd
-
查看进程信息
ps中打印的cpu信息是从开机到当前时间的平均值,不准确
#-A 列出所有的行程 #-w 显示加宽可以显示较多的资讯 #-au 显示较详细的资讯 #-aux 显示所有包含其他使用者的行程 #au(x) 输出格式 : #USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND #查看所有信息 ps -A #打印指定用户信息 ps -u user #打印较多信息 ps aux