Week 9 Comprehension Flashcards
When the same program is executed twice it will have the same PID.
True
False
FALSE
What will be in (1), (2), (3), (4)? #! /bin/bash # # Kill a specified process # Usage: killp function kill_a_process () { echo "DEBUG: PID= (3) KILLSIG= (4)" } kill_a_process (1) (2) (1) $1, (2) $2, (3) $3, (4) $4 (1) $1, (2) $2, (3) $1, (4) $2 (1) $1, (2) $2, (3) $2, (4) $1 (1) $2, (2) $1, (3) $2, (4) $1
(1) $1, (2) $2, (3) $2, (4) $1
How do you place a command that’s running in the foreground into the background?
Type CTRL+b followed by bg and press the enter key.
Type CTRL+c followed by bg and press the enter key.
Type CTRL+d followed by bg and press the enter key.
Type CTRL+z followed by bg and press the enter key.
Type CTRL+z followed by bg and press the enter key.
How do you start a sleep command to run in the background? $ bg | sleep $ sleep | bg $ sleep % $ sleep &
$ sleep &
Find the match.
SIGHUP SIGINT SIGKILL SIGTERM
2 15 9 1
Find the match.
SIGHUP = 1
SIGINT = 2
SIGKILL = 9
SIGTERM = 15
What value will be displayed at (1) and (2)? $ ls file1 (file1 exists) $ echo "$?" (1) $ ls file2 (file2 does not exist) $ echo "$?" 2 $ echo "$?" (2)
(1) 0, (2) 0
(1) 0, (2) 2
(1) 1, (2) 2
(1) $1, (2) $2
(1) 0, (2) 0
Which commands can you use to view process information? (Select two) lsps ps ptree top
ps
top
When will the following entry in the user crontab be executed?
1 2 3 4 * /bin/go_catch_Pokemon
1:02 am on March 4
January 2nd at 3:04 am
Monday, February 3rd at 4:00 am
1 minute after 2 am on the 3rd of April
1 minute after 2 am on the 3rd of April
Which statements are true? (Select two)
The root user can set a priority to a process
The lower the nice value is, the higher the chance will be for the specified process to receive more time slice.
The higher the nice value is, the lower the process priority value will be.
An owner of a process can “be nice” to other processes by increasing the nice value.
The lower the nice value is, the higher the chance will be for the specified process to receive more time slice.
An owner of a process can “be nice” to other processes by increasing the nice value.
Which one is NOT a Linux scheduling tool?
anat
at
anacron
cron
anat
Which command entered without arguments is used to display a list of processes running in the current shell?
a. pgrep
b. list
c. pid
d. ps
PS
Which of the following statements is true? (Choose all that apply.)
a. If /etc/at.allow exists, only users listed in it can use the at command.
b. If /etc/cron.allow exists, only users listed in it can use the cron command.
c. If /etc/cron.deny exists and /etc/cron. allow does not exist, any user not listed in /etc/cron.deny can use the cron command.
d. If /etc/cron.allow and /etc/cron.deny exist, only users listed in the former can use the cron command, and any users listed in the latter are denied access to the cron command.
e. If a user is listed in both /etc/cron.allow and /etc/cron.deny, then /etc/cron.deny takes precedence and the user cannot access the crontab command.
d. If /etc/cron.allow and /etc/cron.deny exist, only users listed in the former can use the cron command, and any users listed in the latter are denied access to the cron command.
e. If a user is listed in both /etc/cron.allow and /etc/cron.deny, then /etc/cron.deny takes precedence and the user cannot access the crontab command.
Where are individual user tasks scheduled to run with the cron daemon stored on a Fedora system?
a. /etc/crontab
b. /etc/cron/username
c. /var/spool/cron
d. /var/spool/cron/username
d./var/spool/cron/username
Which process has a PID of 1 and a PPID of 0?
a. the kernel itself
b. ps
c. init/systemd
d. top
c. init/systemd
A process spawning or initiating another process is referred to as _________.
a. a child process
b. forking
c. branching
d. parenting
b. forking
As daemon processes are not associated with terminals, you must use an option such as -e alongside the ps command to view them.
True or False?
True
Which of the following commands will most likely increase the chance of a process receiving more time slices?
a. renice 0
b. renice 15
c. renice -12
d. renice 19
c. renice -12
Under which conditions can user1 schedule a command using at command? (Select two)
Both /etc/at.allow and /etc/at.deny exist but they are empty
/etc/at.allow exists with user2 in it, not user1. /etc/at.deny does not exist
/etc/at.allow does not exist. /etc/at.deny exists with user2 in it, not user1
/etc/at.allow exists with user1 in it. /etc/at.deny also exists with user1 in it
/etc/at.allow does not exist. /etc/at.deny exists with user2 in it, not user1
/etc/at.allow exists with user1 in it. /etc/at.deny also exists with user1 in it
Which one is NOT a command used to terminate a process or processes?
terminate
kill
killall
pkill
terminate
How do you display the background processes running in the current shell?
$ lsbg
$ jobs
$ ps -bg
$ bg -l
$ jobs
Which statements are true? (Select two)
[user1@linux ~]$ ps -f
-
user1 5994 2670 0 14:47 pts/2 00:00:00 bash
user1 6044 5994 0 14:49 pts/2 00:00:00 bash
user1 6466 6044 0 14:52 pts/2 00:00:00 gedit file
user1 6548 6044 0 14:54 pts/2 00:00:00 ps -f
-
PID of gedit is 6044
PPID of ps -f is 6044
gedit was started from bash (6466)
bash (6044) was started from bash (5994)
PPID of ps -f is 6044
bash (6044) was started from bash (5994)
How do you bring the “sleep 500” process to the foreground?
[user1@okuda 145]$ jobs
[1] Running sleep 400 &
[2]- Running sleep 500 &
[3]+ Running sleep 600 &
$ %
$ fg %2
Type CTRL+z followed by fg and press the enter key.
$ fg sleep 500
$ fg %2
Which statements are true as you examine the following output? (Select two)
[user1@linux]$ ps -f
UID PID PPID C STIME TTY TIME CMD
user1 5994 2670 0 14:47 pts/2 00:00:00 bash
user1 6878 5994 0 17:04 pts/2 00:00:00 ps -f
ps -f process forked a child process
bash was blocked while the ps command was running
The command $ ps -f given at the bash command prompt is shown as the ps -f process in the output
The ps -f process shown in the output is different from the command $ ps -f given at the bash command prompt
bash was blocked while the ps command was running
The command $ ps -f given at the bash command prompt is shown as the ps -f