Friday, March 29, 2013

Ps - process control

Ps return a snapshot of the current processes.
Pay attention 'cause ps -a is distinct from ps a
This version of ps accepts several kinds of options:
-UNIX options, which may be grouped and must be preceded by a dash.
-BSD options, which may be grouped and must not be used with a dash.
-GNU long options, which are preceded by two dashes.
Syntax : ps [options]
Options :
-A : Select all processes
-a : Select all processes except both session leaders and processes not associated with a terminal
-d : Select all processes except session leaders
g : Really all, even session leaders
-N : Select all processes except those that fulfill the specified conditions
T : Select all processes associated with this terminal
r : Restrict the selection to only running processes
-C cmdlist : Select by command name
-G grouplist : Select by real group ID or name
-g grouplist : Select by session OR by effective group name
-p pidlist : Select by process ID
--ppid pidlist : Select by parent process ID
-s sessionlist : Select by session ID
-t ttylist : Select by tty
-U userlist : Select by real user ID or name
-u userlist : Select by effective user ID or name
-c : Show different scheduler information for the -l option
-f : Do full-format listing
-F : Extra full format
-j : Jobs format
-l : Long format
-M : Add a column of security data
s : Display signal format
u : Display user-oriented format
v : Display virtual memory format
X : Register format
--columns n : Set screen width
--lines n : Set screen height
--cumulative : Include some dead child process data
e : Show the environment after the command
f : ASCII art process hierarchy
h : No header
-H : Show process hierarchy
--headers : Repeat header lines
-n namelist : Set namelist file
Examples :
ps -e : see every process
ps -ef : see every processes with full format listing
ps -U hackforlulz : see every processes running as hackforlulz user (real)
ps -p 666 : see process with pid = 666

ps -p 666 -H : see process with pid = 666 and the hierarchy
For more informations about ps type : man ps

If you have a problem or you need some explanations just write under this post!

No comments:

Post a Comment