Processes and Job Control Flashcards

1
Q

What command should we use to display current running processes?

A

ps

root@CentOS # ps -ef | tail -10
ec2-user    3750    3736  0 14:40 ?        00:00:00 sshd: ec2-user@pts/0
ec2-user    3751    3750  0 14:40 pts/0    00:00:00 -bash
root        3774       2  0 14:45 ?        00:00:00 [kworker/u30:0-events_unbound]
root        3775       2  0 14:45 ?        00:00:00 [kworker/0:0-events]
root        3779    3751  0 14:48 pts/0    00:00:00 sudo su -
root        3781    3779  0 14:48 pts/0    00:00:00 su -
root        3782    3781  0 14:48 pts/0    00:00:00 -bash
root        3806       2  0 14:52 ?        00:00:00 [kworker/0:1-events]
root        3817    3782  0 14:56 pts/0    00:00:00 ps -ef
root        3818    3782  0 14:56 pts/0    00:00:00 tail -10

-e = for all process from all user
-f = for details with all column

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

How can we see all the processes (not only the ones for the current session) with ps?

A

ps -ef

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

What command should we use for seeing the processes in a tree like view?

A

pstree

root@CentOS # pstree
systemd─┬─NetworkManager───2*[{NetworkManager}]
        ├─2*[agetty]
        ├─auditd───{auditd}
        ├─chronyd
        ├─crond
        ├─dbus-broker-lau───dbus-broker
        ├─rngd
        ├─rsyslogd───2*[{rsyslogd}]
        ├─sshd───sshd───sshd───bash───sudo───su───bash───pstree
        ├─systemd───(sd-pam)
        ├─systemd-journal
        ├─systemd-logind
        └─systemd-udevd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What command should we use for an interactive process viewer?

A

top or htop (htop is not present in some Linux Systems)

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

Which command should we use to run a command in the background?

A

command &

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

How can we kill a process that’s currently running in the foreground?

A

CTRL+c

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

How can we suspend a process that’s currently running in the foreground?

A

CTRL+z

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

What command should we use to activate a suspended process in the background?

A

bg

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

What command should we use to bring a process from the background to the foreground?

A

fg

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

What command should we use to kill a process?

A

kill

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

What command should we use to list all the current jobs?

A

jobs

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

What is the kill signal number?

A

-15 is the kill signal, -9 is a force kill signal.

root@CentOS # top &
[1] 3838
root@CentOS # kill -15 3838
[1]+  Stopped                 top
How well did you know this?
1
Not at all
2
3
4
5
Perfectly