Processes Flashcards

1
Q

How do you list processes running on the system

A

ps

i.e ps -aux

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

How do you search for a process?

A

pgrep >pname<
pgrep -l >name< *show name aswell as PID
ps aux | grep >name

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

How do you search for processes belonging to a specific user?

A

pgrep -u

i.e pgrep -u cloud_user -l

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

How do you do an inverse search for a process?

A

pgrep -v

i.e pgrep -v -u user *all processes not owned by user

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

How do you kill a process using its name?

A

pkill >pname

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

How do you list all possible kill signals?

A

kill -l

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

What is the default kill signal of pkill and kill?

A

15 - SIGTERM

*instructs program to close

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

How would you kill a program that is not responding to a standard kill signal?

A

9 - SIGKILL
kill -9 >PID<
*forces program to close

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

What is kill -SIGHUP?

A

1 - SIGHUP
kill -1 >PID<
hang up connection to controlling processes within terminal, is issued when closing a terminal

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

What is kill -SIGINT?

A

2 - SIGINT
kill -2 >PID<
keyboard interrupt

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

What is kill -SIGQUIT?

A

3 - SIGQUIT

process sent by controlling terminal for it to quit

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

What is kill -SIGSTOP?

A

19 - SIGSTOP
kill -19 >PID<
stop a running process (pause)

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

What is kill -SIGTSTP

A

20 - SIGTSTP
kill -20 >PID<
request a process to stop (pause), can be ignored by process

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

What is kill -SIGCONT?

A

18 - SIGCONTINUE
kill -18 >PID<
resume a stopped process

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

How do you close a users terminal window?

A

pkill -t >tty<

*get tty (terminal) from w command

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

How would you kill a process for another user only?

A

pkill -u >user< >pname<

i.e pkill -u cloud_user sshd

17
Q

How do you run a command and put it in the background as a job?

A

‘&’ command

i.e yes&raquo_space; /dev/null &

18
Q

How do you show running jobs?

A

jobs

19
Q

How do you stop (pause) a running job?

A

kill -19 %

*% targets job instead of process

20
Q

What is nice an renice?

A

Sets the priority for a process
-20 - highest priority
19 - lowest priority

21
Q

How do you start a process with a specific priority level?

A

nice -n >n< >pname<

i. e nice 0 httpd
* child processes will have the same priority

22
Q

How do you set the priority of an already running process?

A

renice -n >n< >pid<

i.e renice 5 2743

23
Q

How do you set the priority of all running processes with a specific name?

A

renice -n {n} $(pgrep {pname})

*$() subshell is evaluated as a command and passed as a parameter to renice

24
Q

How do you measure the time for a command to complete?

A

time

i.e time w

25
Q

How would you get the number of processors on a system?

A
cat /proc/cpuinfo | grep 'model name' | wc -l
*/proc/cpuinfo is pseudo filesystem
26
Q

Within the top command what are RES and SHR?

A

RES - no swap physical memory size

SHR - shared memory size

27
Q

How do you use top to refresh a specified number of times then quit?

A

top -n >n<

i.e top -n 5

28
Q

How do you use top with a specific frequency to update process information?

A

top -d >n<

i. e top -d 0.5
* twice a second

29
Q

What is the output of load average for instance with the uptime command?

A

load average 1m 5m 15m

*divide percentage by number of CPUs to get system as a whole, numbers are represented in decimal format