Linux Scroll

Just another WordPress.com site

ps

ps – Process Status

To see every process on the system using standard syntax:

$ ps -e

$ ps -ef
$ ps -eF
$ ps -ely
-e = Select all processes. Same as -A.
-f = Full-format listing.
-F = Extra full format.
-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.

Grep process PID:

$ ps -ef | grep %username | grep -i %process_name | grep -v grep | awk '{print $2}'

$ ps U %username | grep -i %process_name | grep -v grep | awk '{print $1}'

To print a process tree:

$ ps -ejH

-j = jobs format
-H = show process hierarchy (forest)

Displaying all processes owned by a specific user:

$ ps ux

OR
$ ps U username
-u userlist Select by effective user ID (EUID) or name.
U = processes for specified users

To get info about threads:

$ ps -eLf

$ ps axms
-L = list format codes
-x = processes w/o controlling ttys
-m = threads
-s = processes in the sessions given

To get security info:

$ ps -eo euser,ruser,suser,fuser,f,comm,label

$ ps axZ
$ ps -eM

M,Z = security data

To see every process running as root (real & effective ID) in user format:

$ ps -U root -u root u

Different format:

$ ps -o "%u : %U : %p : %a"

RUSER : USER : PID : COMMAND

Print only the process IDs of syslogd:

$ ps -C syslogd -o pid=

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: