ps Flashcards

1
Q

ps

A

ps displays information about a selection of the active processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

ps [SIMPLE PROCESS SELECTION]

a

  • A, -e
  • a
  • d

g

A

a, BSD-style Lists all processes with a terminal (tty).

  • A, -e, 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, List all, even session leaders, obsolete command.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

ps [SIMPLE PROCESS SELECTION]

-N, –deselect

T

r

x

A

-N, –deselect, Select all processes except those that fulfill the specified condition. (Negates the selection)

T, Select all processes associate with this terminal.

r, Restrict the selection to only running processes.

x, List all processes owned by you.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

ps [PROCESS SELECTION BY LIST]

  • C
  • G
  • g
  • p, p, -123, 123

–ppid

-q, q

A
  • C cmdlist, Select by command name.
  • G, –Group grplist, Select by real group ID (RGID) or name.
  • g, –group grplist, Select by effective group ID (EGID) or name.
  • p, p, -123, 123, –pid pidlist, Select by process ID.

–ppid pidlist, Select by parent process ID.

-q, q, –quick-pid pidlist, Select by PID (quick mode).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

ps [PROCESS SELECTION BY LIST]

  • s
  • t, t
  • u, U
  • U
A
  • s, –sid sesslist, Select by session ID.
  • t, t, –tty ttylist, Select by terminal.
  • u, U, –user userlist, Select by effective user ID (EUID) or name.
  • U, –User userlist, Select by real user ID (RUID) or name.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

ps -e –forest

A

This command prints all processes and displays them as a tree with the –forest option.

f, –forest, ASCII art process tree.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

ps -fL -C httpd

A

-f, Do full-format listing. This can be used with additional options to add columns.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

ps [THREAD DISPLAY]

H

-L

m, -m

-T

A

H, Show threads as if they were processes.

-L, Show threads, possibly with LWP and NLWP columns.

m, -m, Show threads after processes.

-T, Show threads, possibly with SPID column.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ps L

A

L, List all format specifiers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

ps -o

A

-o, o, –format format, User defined format. Format is a single argument in the form of a blank separated or comma separated list, which offers a way to specify different output columns.

Example:

pid,ppid,fgroup,ni,lstart,etime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

ps -p 1154 -o comm=

A

-o comm=, Will make the ps command display the command that this process ID is running.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

ps -eo comm,etime,user | grep httpd

A

These commands chain together checks the time of a process.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

ps –context

A

This displays the security context format.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

watch -n 1 ‘ps -eo pid,ppid,cmd,%mem,%cpu –sort=-%mem | head’

A

This sequence of commands sets watch to display a list of processes routinely.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly