linux!ps命令 linux的ps命令用法

linux命令中ps -ef详解1、ps -ef表示bai查看全格式的全部进程 。
ps是linux下最常用的也是非常强大的进程查看命令linux!ps命令 , 常配合管道命令 | 和查找命令 grep 同时执行来查看特定进程 。
参数含义:
-e 显示所有进程 。-f 全格式 。-h 不显示标题 。-l 长格式 。-w 宽输出 。a 显示终端上的所有进程,包括其linux!ps命令他用户的进程 。r 只显示正在运行的进程 。x 显示没有控制终端的进程 。
2、扩展资料linux!ps命令:
【linux!ps命令 linux的ps命令用法】 进程状态:
R 运行,正在运行或在运行队列中等待 。
S 中断,休眠中, 受阻, 在等待某个条件的形成或接受到信号 。
D 不可中断,收到信号不唤醒和不可运行, 进程必须等待直到有中断发生 。
Z 僵死 ,进程已终止, 但进程描述符存在, 直到父进程调用wait4()系统调用后释放 。
T 停止,进程收到SIGSTOP, SIGSTP, SIGTIN, SIGTOU信号后停止运行运行 。
3、grep命令是查找
中间的|是管道命令 是指ps命令与grep同时执行
PS是LINUX下最常用的也是非常强大的进程查看命令
grep命令是查找,是一种强大的文本搜索工具,它能 使用正则表达式 搜索文本,并把匹配的行打印出来 。
grep全称是Global Regular Expression Print,表示全局正则表达式版本,它的使用权限是所有用户 。
以下这条命令是检查java 进程是否存在:ps -ef |grep java
字段含义如下:
UIDPIDPPIDCSTIMETTYTIMECMD
zzw1412413991000:38pts/000:00:00grep --color=auto dae
UID:程序被该 UID 所拥有
PID:就是这个程序的 ID
PPID:则是其上级父程序的ID
C:CPU使用的资源百分比
STIME :系统启动时间
TTY:登入者的终端机位置
TIME:使用掉的CPU时间 。
CMD:所下达的是什么指令
ps -e|grep dae
【ps】关于Linux ps命令的妙用How to get all process ids without ps command on Linux?
On Linux, all running process have "metadata" stored in the/proc filesystem .
# manps
# ps -C sshd --no-header
# ps -C dockerd --no-header
-C cmdlist
Select by command name.This selects the processes whose executable name is given in cmdlist.
you can use the long options --headers and --no-headers to enable printing headers each page or disable headers entirely, respectively.
#ps -eo nlwp,pcpu,user,pid,ppid,args--sort nlwp
注:以 nlwp排序,默认正序
LWP -- 轻量级进程,即线程
NLWP --线程数,即 number of threads in process
#ps -eo pid,cmd,%mem,%cpu --sort=-%mem
Thecommand is highly valuable for system admins during troubleshooting the system.
You can display the processes list in a sorted manner to find out the highest memory usage processes.
#ps -mp${pid}-oTHREAD,tid,time
参数解释:
-m:显示所有的线程
-p:pid进程使用CPU的时间
-o:该参数后是用户自定义格式 。
如:THREAD,tid,time表示线程、线程ID号、线程占用的时间 。
$ ps -Hp${pid}
ps(1) — Linux manual page
Linux PS command with examples
How to get all process ids without ps command on Linux?
What is the difference between ps and top command?
linux ps查看进程显示的是用户ID , 不是用户名是怎么回事?使用ps命令时,发现部分用户显示的是用户名,有些用户显示的是UID,例如nmon程序的运行时webmaster,但是ps显示的不是直接显示uid 500 。
通过man发现:8位用户名的账户能够显示完整的用户名,9位用户名的账户就显示了UID使用下面的命令来解决;
ps -o ruser=userForLongName -e -o pid,ppid,c,stime,tty,time,cmd
注意:“userForLongName”是随便填写的,Linux会自动检查此字符串的长度,为15,则15位以下的用户名都可以正常显示 。

推荐阅读