文章目录
Linux系统状态管理
1、查看系统信息
日期时间
date
cal
uptime
w
系统版本
cat /etc/redhat-release
uname -a
cat /proc/versio
2、进程管理
程序、进程、服务
- 程序 program
- 进程 process
- 服务 service
systemctl list-unit-files |grep mysql
cat /etc/services |grep mysql
运行程序
# 前台运行
./xxx
# 后台运行
nohup ./xxx &
查看进程 top
ps
全拼:process status
ps -ef
ps -aux
pstree
pstree -p
pstree mysql (查看用户的进程树)
pstree -p | grep ssh
服务管理
systemctl
systemctl和service
停止程序
3、内存使用情况
free
free
free -h
free -m
4、磁盘使用情况
磁盘使用情况
du
全拼:disk usage
综合命令 sar
全拼:system activity reporter
%user:用于表示用户模式下消耗的 CPU 时间的比例;
%nice:通过 nice 改变了进程调度优先级的进程,在用户模式下消耗的
CPU 时间的比例;
%system:系统模式下消耗的 CPU 时间的比例;
%iowait:CPU 等待磁盘 I/O 导致空闲状态消耗的时间比例;
%steal:利用 Xen 等操作系统虚拟化技术,等待其它虚拟 CPU 计算占
用的时间比例;
%idle:CPU 空闲时间比例。
5、定时任务
定时任务
工具:crontab
全拼:cron table
Cron表达式:
https://tool.lu/crontab