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

About the Author

Sandeep Agrawal
working @ Kalpavruksh Technologies as Software Engineer. I am a simple and straightforward person adaptable to any environment and work culture. Like to work in a creative and challenging environment using cutting edge technologies where I could constantly learn and successfully deliver solutions to problems.

Be the first to comment on "Using ps command to get process detailed information"

Leave a comment

Your email address will not be published.


*


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