Some useful ps commands switch combinations and examples are explained below:

1. ps aux & ps ax

These commands will print all process running on the system(server). aux displays more details like user, cpu, memory etc. with respect to ax.

# ps ax
# ps aux


2. Print processes like a tree format

# ps -ejH
# ps axjf
# pstree


3. Print security information

# ps -eo {euser, ruser, suser, fuser, comm, label}
# ps axZ
# ps -eM

This switch combination displays fue features like terminal, process ID, commands, time etc.. which are related to security.


4. Find out the top 10 memory consuming process on the system(server)

 # ps -auxf | sort -nr -k 4 | head -10


5. Find out top 10 CPU consuming process

 # ps -auxf | sort -nr -k 3 | head -10


6. Find out every process running under a user.

# ps -U user-name -u user-name u


7. Display only the process ID of a particular process under the system(server)

# ps -C PROCESS -o pid= 
Or 
# pgrep PROCESS 
Or
# pgrep -u user-name PROCESS (running under the user)


8. PS command to displays the process name having a particular PID

#  ps -p PID -o comm=

 


Additional information:

# ps -Al : Show Long Format Output.
# ps -AlF : To turn on extra full mode (it will show command line arguments passed to process).
# ps -AlFH : To See Threads ( LWP and NLWP).
# ps -AlLm : To See Threads After Processes.
# ps -e
# ps -ef
# ps -eF
# ps -ely
# -e Select all processes. Identical to -A.
# -f does full-format listing. This option can be combined with many other UNIX-style options to add additional columns. It also causes the command arguments to be printed. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. See the c option, the format keyword args, and the format keyword comm.
# -F extra full format. See the -f option, which -F implies.
# -l long format. The -y option is often useful with this.
# -y Do not show flags; show rss in place of addr. This option can only be used with -l.


Was this answer helpful? 0 Users Found This Useful (0 Votes)