A bit about

Hello, everyone! All you can see below is just my bank of information. Some material I've found in the fathomless net, some I've learned myself. Don't think all of the information here is right or actual, but may be it could be of use for you :) All feedback is welcome, especially constructive ones :)

Tuesday, October 20, 2009

Linux: ps output fomat

It took for me some time to find the solution, because "ps --help" doesn't print the full information especially about output format. I often need to obtain some process ID from script, based on command name and its arguments.

The first solution is to parse "ps -aux". But it's not convenient because pid is not the first column. I found command in the man page:
$ ps -eo pid,comm,args
It allows one to define certain columns. Possible keys are:
pcpu; group; ppid; user; args; comm; rgroup; nice; pid; pgid; etime; ruser; time; tty; vsz

0 comments:

Post a Comment