ps命令百分之九十九的人都会使用,但是很少人知道他的参数选项,因为实在太复杂了,普通人应该没法记全。而多数时候ps -ef(查进程) 和 ps aux(查进程cpu和内存使用)足以满足日常使用。
想使用ps命令输出进程用户和组就无法通过以上命令实现,通过查看资料可以通过 “ps -eo pid,user,group,cmd ”实现。
-e Select all processes. Identical to -A. -o format User-defined format.
可用选项应该 LONG对于选项都可以,具体参考ps(1) - Linux manual page。
KEY LONG DESCRIPTION c cmd simple name of executable C pcpu cpu utilization f flags flags as in long format F field g pgrp process group ID G tpgid controlling tty process group ID j cutime cumulative user time J cstime cumulative system time k utime user time m min_flt number of minor page faults M maj_flt number of major page faults n cmin_flt cumulative minor page faults N cmaj_flt cumulative major page faults o session session ID p pid process ID P ppid parent process ID r rss resident set size R resident resident pages s size memory size in kilobytes S share amount of shared pages t tty the device number of the controlling tty T start_time time process was started U uid user ID number u user user name v vsize total VM size in KiB y priority kernel scheduling priority