Open JesseZhao1990 opened 6 years ago
ps 即 process status,也就是查看进行的状态。ps为我们提供了进程的一次性的查看,它所提供的查看结果并不动态连续的;如果想对进程时间监控,应该用 top 工具
ps [参数]
a 显示所有进程 -A 显示所有进程 -e 等于“-A” e 显示环境变量 f 显示程序间的关系 u 指定用户的所有进程 -au 显示较详细的资讯 --lines<行数> 每页显示的行数 --width<字符数> 每页显示的字符数 --help 显示帮助信息 --version 显示版本显示
ps -ef // 显示所有进程(-e) 显示程序间的关系(f)
UID PID PPID C STIME TTY TIME CMD root 1 0 0 Dec06 ? 00:00:00 /sbin/init root 2 0 0 Dec06 ? 00:00:00 [kthreadd] root 3 2 0 Dec06 ? 00:00:04 [migration/0] root 4 2 0 Dec06 ? 00:00:01 [ksoftirqd/0] root 5 2 0 Dec06 ? 00:00:00 [stopper/0] root 6 2 0 Dec06 ? 00:00:02 [watchdog/0] root 7 2 0 Dec06 ? 00:00:05 [migration/1] root 8 2 0 Dec06 ? 00:00:00 [stopper/1] root 9 2 0 Dec06 ? 00:00:01 [ksoftirqd/1] root 10 2 0 Dec06 ? 00:00:02 [watchdog/1] root 11 2 0 Dec06 ? 00:02:03 [events/0]
结合grep命令使用可筛选查找结果
ps -ef | grep nginx
root 3095 1 0 15:50 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf root 3096 3095 0 15:50 ? 00:00:00 nginx: worker process root 5174 1226 0 16:22 pts/4 00:00:00 grep nginx
用途
ps 即 process status,也就是查看进行的状态。ps为我们提供了进程的一次性的查看,它所提供的查看结果并不动态连续的;如果想对进程时间监控,应该用 top 工具
使用格式
ps [参数]
参数解释
使用实例
结合grep命令使用可筛选查找结果