Week 9 Comprehension Flashcards

1
Q

When the same program is executed twice it will have the same PID.
True
False

A

FALSE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
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
A

(1) $1, (2) $2, (3) $2, (4) $1

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

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.

A

Type CTRL+z followed by bg and press the enter key.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
How do you start a sleep command to run in the background?
  $ bg | sleep  
  $ sleep  | bg 
  $ sleep  % 
  $ sleep  &
A

$ sleep &

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

Find the match.

SIGHUP SIGINT SIGKILL SIGTERM

          2        15       9    1
A

Find the match.

SIGHUP = 1

SIGINT = 2

SIGKILL = 9

SIGTERM = 15

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
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

A

(1) 0, (2) 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q
Which commands can you use to view process information? (Select two)
  lsps 
  ps 
  ptree 
  top
A

ps

top

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

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

A

1 minute after 2 am on the 3rd of April

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

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.

A

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.

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

Which one is NOT a Linux scheduling tool?

anat
at
anacron
cron

A

anat

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

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

A

PS

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

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.

A

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.

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

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

A

d./var/spool/cron/username

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

Which process has a PID of 1 and a PPID of 0?

a. the kernel itself
b. ps
c. init/systemd
d. top

A

c. init/systemd

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

A process spawning or initiating another process is referred to as _________.

a. a child process
b. forking
c. branching
d. parenting

A

b. forking

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

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?

A

True

17
Q

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

A

c. renice -12

18
Q

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

A

/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

19
Q

Which one is NOT a command used to terminate a process or processes?

terminate
kill
killall
pkill

A

terminate

20
Q

How do you display the background processes running in the current shell?

$ lsbg
$ jobs
$ ps -bg
$ bg -l

A

$ jobs

21
Q

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)

A

PPID of ps -f is 6044

bash (6044) was started from bash (5994)

22
Q

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

A

$ fg %2

23
Q

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

A

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