1.4 Given a scenario, configure and use the appropriate processes and services Flashcards

1
Q

Command to start daemon/service

A

systemctl start [service]

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

Command to stop daemon/service

A

systemctl stop [service]

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

Command to restart daemon/service

A

systemctl restart [service]

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

Command to get status of daemon/service

A

systemctl status [service]

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

Command to automatically start service on system boot

A

systemctl enable [service]

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

Command to remove service from automatically starting on system boot

A

systemctl disable [service]

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

Command to stop a service from being started at all, either manually or automatically

A

systemctl mask [service]

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

What does the top command do?

A

Shows an abbreviated, dynamic list of processes and their mem & cpu usage

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

What does the ps command do? What is the default if no options are added to it?

A
  1. Shows a static list of processes
  2. Default behavior only shows active “user” processes for the current shell
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does ps command option “A” or “e” do?

A

Shows all processes

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

What 2 ps command options show more detailed info about processes?

A

-l and -f

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

What ps command option shows the state (i.e. running, sleeping, zombie, etc) of processes?

A

-l

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

What ps command option shows processes for a specific user?

A

-u

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

What ps command option shows processes that are started during system boot?

A

-x

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

What are the 4 state letter codes for processes?

A
  1. “R” running
  2. “S” sleeping
  3. “T” traced
  4. “Z” zombie
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does the pgrep command do?

A

Combines functionality of ps & grep command into an easier to use command

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

What are the 3 most common pgrep options and what do they do?

A
  1. -f search for the specified process name
  2. -u show all processes owned by a specific user
  3. -p show all processes with PPID specified
18
Q

How can a process be started to run in the background?

A

[command] followed by [space] &

19
Q

What does the jobs command do?

A

Lists the processes running in the background with JobID and state (i.e. running, stopped)

20
Q

In the shell, how can a process running in the foreground be moved to the background? (3)

A
  1. Press Ctrl + z to stop the current process and assign it a JobID
  2. Run jobs command to see a list of the processes and JobIDs
  3. To start the job in the background, use command: bg [JobID]
21
Q

In the shell, how can a process be moved from running in the background to the foreground? (2)

A
  1. Use jobs command to list the processes running in the background
  2. command fg [JobID] to move the program to the foreground
22
Q

What does Ctrl + z do?

A

Stops the currently running (foreground) app/process/command and assigns JobID for it as a background process

23
Q

How does the priority value affect a process’ access to CPU time?

A

Inversely, The higher the value, the less CPU time the process gets

24
Q

How can the priority of a process be changed?

A

Although the priority can’t be directly modified, a nice level can be set which adjusts the priority assigned by the system

25
Q

What does the nice command do? What is the syntax?

A
  1. Starts a process and specifies the nice level which affects the priority the process will run with
  2. nice -n [nice_level] [command]
26
Q

What does the renice command do? What is the syntax?

A
  1. Modifies the nice level, or priority, of a currently running process
  2. renice -n [nice_level] [PID]
27
Q

What is the range that can be specified for a nice level?

A

-20 to 19

28
Q

What restriction exists when setting nice level?

A

Unless executed with root privilege, user can only be values from 0 to 19
Only root can assign a negative nice level

29
Q

What 3 commands can be used to terminate a process?

A
  1. kill
  2. killall
  3. pkill
30
Q

What does Ctrl+c do?

A

Interrupts and stops a process by sending the SIGINT signal

31
Q

What does the SIGHUP signal do?

A

Shuts down and restarts a process

32
Q

What does the SIGKILL signal do?

A

Forces a process to stop, without releasing resources allocated to it, when it is unresponsive all other options to stop it fail

33
Q

What does the SIGTERM signal do?

A

Stops a process cleanly and releases resources allocated to it

34
Q

In what order should signals be sent to try to kill a process?

A
  1. SIGINT (Ctrl+c)
  2. SIGTERM
  3. SIGKILL
35
Q

What are the alternative numeric values for the 4 signal types sent with kill command(s)?

A

SIGHUP - 1
SIGINT - 2
SIGKILL - 9
SIGTERM - 15

36
Q

Syntax of kill command

A

kill [signal] [PID]

37
Q

Syntax of killall command

A

killall [signal] [process name]

38
Q

Syntax of pkill command

A

pkill [signal] -f [search term for proc name]

39
Q

What is the default signal, if none is specified, for all 3 kill commands?

A

SIGTERM

40
Q

What does htop command do?

A

Shows a graphical view of system processes and real-time memory & cpu usage, kind of like task manager does in Windows