bash 如何让ps打印组?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20236582/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to get ps to print group?
提问by user782220
ps aux
will print out something formatted according to the below. It shows the user that the process runs under. But is there a way to display the group that the process runs under?
ps aux
将打印出根据以下格式设置的内容。它向用户显示进程在其下运行。但是有没有办法显示进程运行所在的组?
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
回答by devnull
You can specify the desired format:
您可以指定所需的格式:
o format
Specify user-defined format. Identical to -o and --format.
For example, saying:
例如说:
ps o pid,group
would print pid
and group
.
将打印pid
和group
。
Saying:
说:
ps o pid,group,gid
would print pid
, group
and group ID
.
会打印pid
,group
和group ID
.
As per your comment, the following might work for you:
根据您的评论,以下内容可能对您有用:
ps o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid
To see all processes:
查看所有进程:
ps ax o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid