103.5 Create, monitor and kill processes Flashcards

1
Q

What is the command that kills processes based on a name provided as an argument?

A
#killalll
Example:
#sudo killall httpd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you kill a process based on its name and not process ID, only matching the name and nothing else?

A

pkill -x

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

How do you kill a process based on its name and not process ID?

A

sudo pkill

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

How do you kill a process gracefully?

A
  1. Find the PID with pgrep or top
  2. Issue #sudo kill
    (kill alone will use -15)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you kill a process ungracefully or forcibly?

A
Find the process ID
#kill -9
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What command will list all the Signals that can be passed on to the kill command?

A

kill -l

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

How are stale PID files created?

A

When a process is killed ungracefully with SIGKILL (9).

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

What is the difference between SIGTERM(15) and SIGKILL(9)?

A

KILL 15 kills a process gracefully (SIGTERM)

KILL 9 kills it suddenly and ungracefully (SIGKILL)

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

How do you kill a process within #top?

A

Determine the PID from the list
Press the K key
Enter the PID

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

What is PID 1 called? What are the other processes that emerge from it called?

A

PID 1 : parent process

PID X: child processes

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

What command is used to display a listing of jobs that are in the background?

A

jobs

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

How do you send a command to the background?

A

You type the command and add the symbol at the end.

Also you can type at the end.

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

What command do you use to bring a command that was running in the background to the foreground?

A

fg and the job id (from the #jobs -l command)

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

What is the command called that when preceding a command, the command receives a signal 1 (NOHUP) so that should a terminal window close, the process will still run as long as the login session is not terminated.

A

nohup

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

What happens if you log out from a session and have commands running in the background still?

A

The commands get cancelled.

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

How do you exit or close a detached tmux session?

A

exit

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

How do you re-attach to a currently running session open with tmux?

A
#tmux ls
Get the session number
#tmux attach-session -t session#
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How do you see how many sessions you have running with tmux?

A

tmux ls

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

How do you see how many screen sessions you have running?

A

screen -ls

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

How do you detach from a running tmux session to an original session?

A

Ctrl+b d

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

What does the screen command do?

A

It is a terminal window manager that allows you to run commands in an isolated session.

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

How do you create a new shell (other than the screen command)?

A

tmux

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

How do you exit or close a detached screen session?

A

exit (within the detached screen session)

24
Q

How do you go back from an original session to a detached screen created with the command screen?

A

screen -r session# (#before the pts)

25
Q

How do you go back the original session to an already created session made with the command screen?

A

screen -r

26
Q

How do you go back from an isolated session created with the screen command to the original session?

A

Ctrl+a d

27
Q

How do you start an isolated session with the screen command?

A

Using the screen command itself.

28
Q

Which is the command that runs a command at a specified interval to monitor a command’s output?

A

watch

29
Q

How do you modify the default 2 seconds of the watch command?

A

watch -n 5

30
Q

How can you retrieve the process IDs that are related to a process name plus the full command line the process is using?

A

pgrep -a

31
Q

How can you retrieve the process IDs that are related to a process name?

A

pgrep

32
Q

How do you start a given process in a systemd system?

sudo systemctl start

A
33
Q

How do you specify megabytes and gigabytes in the output of #free?

A
#free -m
#free -g
34
Q

In the output of #free, what would a high utilization of swap space mean?

A

It means the system needs more RAM installed.

35
Q

What will the #free command show?

A

It displays the amount of RAM that is available, how much has been used, how much is still free and how much is available for other processes. It also shows the swap space.

36
Q

What does load average 1 mean in the output of #uptime if you have 4 CPUs?

A

It means the processor is used up only 25% and 75% is idle.

37
Q

What does load average 1 mean in the output of #uptime if you have one CPU only?

A

It means the processor is maxed out 100%

38
Q

What does a process in an uninterruptible state mean?

A

A process in an uninterruptible state is waiting on some IO access such as network or HDD access.

39
Q

What does a process in a runnable state mean?

A

A process in a runnable state is using the CPU or waiting to use the CPU

40
Q

What is the load average in the output of #uptime?

A

It is the average number of processes in a runnable or uninterruptible state.

41
Q

What is the timing for load average shown in the output of #uptime?

A

load average: 0.00 0.01 0.05 (last minute, last 5 and last 15 minutes respectively).

42
Q

How do you determine how long a system has been up and running, number of users and load average?

A

uptime

43
Q

What command will print information about processes in near real time?

A

top

44
Q

Where does the #ps command get the information it prints to the screen?

A

From the /proc directory

45
Q

What flag of the #ps command will give a full format listing with all arguments that a command is using while it is running?

A

-f

Ex: #ps -efH

46
Q

What is the command to see all processes for all users in a tree -like fashion?

A

ps -e –forest

47
Q

What command shows the processes running for every single user in a system in a hierarchical manner?

A

ps -eH

48
Q

What is the command to see the processes running for a specific user?

A

ps -u

49
Q

If you run the #ps command by itself with no flags, what will you see?

A

You will see only processes running in the current shell.

50
Q

What command gives a snapshot of the current processes running in a hierarchical manner?

A

ps -eH | less

51
Q

What is the area below PID 1 and PID 2 in the output of #ps called?

A

PID 1: user space

PDI 2: kernel space

52
Q

What does the command #ps use to display a hierarchical order of the processes?

A

It uses indentations at the processes name columns.

53
Q

What is PID 1 called in an init system? What is it called in a systemd system?

A

init and systemd

54
Q

After a Linux system has been booted up, the Linux kernel hands over control to what process?

A

PID 1 (process ID 1)

55
Q

What is a process priority?

A

It dictates how much time the cpu allottes the process.

56
Q

What are some properties that a process has?

A

Memory context
Priority
Environment

57
Q

What is a process?

A

A process is a set of instructions loaded into memory coming from a program that is running.