原创

Linux 系统中查看正在运行的进程

ps 命令是最根本相应情况下也是相当强大地进程查看命令.运用该命令可以确定有哪些进程正在运行和运行地状态、 进程是否结束、进程有没有僵死、哪些进程占用了过多地资源等等.总之大部分信息均为可以通过执行该命令得到地.

显示所有运行中的进程,命令如下:

[root@iZ256w2hluuZ ~]# ps aux | less

部分显示结果如下:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root 1  0.0  0.1  19232  1044 ?Ss   Jul24   0:00 /sbin/init
root 2  0.0  0.0      0     0 ?S    Jul24   0:00 [kthreadd]
root 3  0.0  0.0      0     0 ?S    Jul24   0:00 [migration/0]
root 4  0.0  0.0      0     0 ?S    Jul24   0:00 [ksoftirqd/0]
root 5  0.0  0.0      0     0 ?S    Jul24   0:00 [migration/0]
root 6  0.0  0.0      0     0 ?S    Jul24   0:00 [watchdog/0]
root 7  0.0  0.0      0     0 ?S    Jul24   0:04 [events/0]
root 8  0.0  0.0      0     0 ?S    Jul24   0:00 [cgroup]

按q退出,按h进入帮助。其中,各参数含义:

-A:显示所有进程

a:显示终端包含其它用户所有进程

x:显示无控制终端进程

查看系统中的每个进程,命令如下:

[root@iZ256w2hluuZ ~]# ps -A
[root@iZ256w2hluuZ ~]# ps -e

查看非root运行的进程,命令如下:

[root@iZ256w2hluuZ ~]# ps -U root -u root -N
  PID TTY  TIME CMD
  836 ?00:00:00 nscd
  918 ?00:00:00 ntpd
 1254 ?00:01:12 mysqld
 1308 ?00:00:04 nginx

按q退出,按h进入帮助。

查看用户vivek运行的进程,命令如下:

[root@iZ256w2hluuZ ~]# ps -u vivek

查找进程使用pgrep命令。pgrep能查找当前正在运行的进程并列出符合条件的进程ID,命令如下:

[root@iZ256w2hluuZ ~]# pgrep firefox

显示进程名为sshd、所有者为root的进程,命令如下:

[root@iZ256w2hluuZ ~]# pgrep -u root sshd
~阅读全文-人机检测~

微信公众号“Java精选”(w_z90110),专注Java技术干货分享!让你从此路人变大神!回复关键词领取资料:如Mysql、Hadoop、Dubbo、Spring Boot等,免费领取视频教程、资料文档和项目源码。微信搜索小程序“Java精选面试题”,内涵3000+道Java面试题!

涵盖:互联网那些事、算法与数据结构、SpringMVC、Spring boot、Spring Cloud、ElasticSearch、Linux、Mysql、Oracle等

评论

分享:

支付宝

微信