Skip to content
Home » Using ps command to get process detailed information

Using ps command to get process detailed information

ps gives detail of the current processes.
Below command can be used to get detailed information on the running processes like start time, elapsed time, completely command, an executable command which is running the process etc.

ps -eo pid,comm,lstart,etime,time,args

Below is the detail on what above comma-separated arguments means:

  • comm: command name(only the executable name).
    Ex: php, nodejs, apache2, sh etc.
  • lstart: the time the command started.
    Ex: “Wed Jul 27 10:21:00 2016”.
  • etime: elapsed time since the process was started in the format “[[dd-]hh:]mm:ss”.
    Ex: 7-28:23:23. here 7 is days(dd format).
  • time: cumulative CPU time in format “[dd-]hh:mm:ss”.
    Ex: 7-06:24:44. here 7 is days(dd format).
  • args: command with all its arguments as a string.
    Ex: “/usr/sbin/apache2 -k start”

Sample output:

process status details

 

Some other useful commands:

  • Filter processes by its user:
    ps -u <username>
  • Filter processes by CPU or memory usage:
    ps -aux –sort -pcpu | less
    ps -aux –sort -pmem | less
  • Show processes in the hierarchy:
    ps -axjf
    pstree
  • Show every process running as root (real & effective ID) in user format:
    ps -U root -u root u
  • Use PS in a real-time process viewer:
    watch -n 1 ‘ps -aux –sort -pmem, -pcpu’

Reference: http://linuxcommand.org/man_pages/ps1.html

Leave a Reply

Your email address will not be published.

0 Shares
Tweet
Pin
Share
Share
Share
%d bloggers like this: