Linux下查看某个进程信息的相关命令介绍
作者:尹正杰
版权声明:原创作品,谢绝转载!否则将追究法律责任。
一.Linux下查看某个进程的线程数量
1>.安装pstree命令行工具,包名为:“psmisc”
[root@yinzhengjie bin]# yum -y install psmisc Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package psmisc.x86_64 0:22.20-15.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================================================================================== Package Arch Version Repository Size ==================================================================================================================================================================== Installing: psmisc x86_64 22.20-15.el7 base 141 k Transaction Summary ==================================================================================================================================================================== Install 1 Package Total download size: 141 k Installed size: 475 k Downloading packages: psmisc-22.20-15.el7.x86_64.rpm | 141 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : psmisc-22.20-15.el7.x86_64 1/1 Verifying : psmisc-22.20-15.el7.x86_64 1/1 Installed: psmisc.x86_64 0:22.20-15.el7 Complete! [root@yinzhengjie bin]#
2>.相关参数介绍
Usage: pstree [ -a ] [ -c ] [ -h | -H PID ] [ -l ] [ -n ] [ -p ] [ -g ] [ -u ] [ -A | -G | -U ] [ PID | USER ] pstree -V Display a tree of processes. -a, --arguments 显示命令时候,并显示其参数的完整内容 -A, --ascii 各进程树之间的连接以ASCII码字符来连接 -c, --compact 取消同名兄弟进程的合并(默认会将同名的兄弟进程合并) -h, --highlight-all 突出当前进程及其祖先 -H PID, --highlight-pid=PID 突出这个过程和它的祖先 -g, --show-pgids 显示进程组ID; -G, --vt100 使用VT100线绘制字符 -l, --long 不要截断长线。 -n, --numeric-sort 用PID排序输出 -N type, --ns-sort=type sort by namespace type (ipc, mnt, net, pid, user, uts) -p, --show-pids 同时列出每个进程的PID -s, --show-parents 显示选定过程的父母 -S, --ns-changes 显示命名空间转换
-u, --uid-changes 同时列出每个进程的所属账号名称 -U, --unicode 各进程树之间的连接以utf8字符来连接,某些终端可能会有错误 -V, --version 显示版本信息 -Z, --security-context 显示SELinux的安全上下文 PID 从这个PID开始;默认值是1(init)。 USER 只显示在该用户的进程中的树
3>.
二.