ITN 171 EXAM 4 Chapter 7 and 8
How do you display all processes, including user and system processes, running on your system?
-Even though nobody may be using the system, a number of system processes are always running in the background, spawned during system startup by init ps -e lists them all
T/F In the shell, any environment variables, aliases, or set options that we define are carried over from one login session to another.
-FALSE
The name of the Bash rc file is defined by the variable BASH_RC.
-FALSE -The rc File is generally ~/.bashrc
T/F It is only possible to recall commands by their event number.
-FALSE -There are other possible way to recall command with history -The shell assigns each command an event number Bash displays the complete event list that is saved in a history file
A login script (also called a profile) is executed every time an interactive sub-shell is created.
-FALSE -A login script (also called a profile), which is executed only once on login -An rc (run command) script, which is executed every time an interactive sub-shell is created
A login script (also called a profile) is executed every time an interactive sub-shell is created.
-FALSE An rc (run command) script, which is executed every time an interactive sub-shell is created
T/F The init process is the parent process of all other processes and so has a PID of 0.
-FALSE PID is always 1
In the Bash shell, if you wanted to turn on vi-like capabilities for editing a line you would enter the set +o vi command on the command line.
-FALSE- set -o vi
In what way can a process respond to a signal?
-Let the default action take place (every signal has a default action) -Ignore the signal -Trap the signal by "catching" the signal and invoking a user-defined signal handling function -ALL OF THE ABOVE??
Is the nohup command required for all shells (Bash, C Shell, Bourne, and Korn Shells)?
-NO,This feature is not required in Bash or C shells because they continue to run after user has logged out
T/F For background jobs, STDOUT (standard output) and STDERR (standard error) normally come to the terminal unless explicitly redirected.
-TRUE
T/F The PID is a unique number assigned to a process by the kernel.
-TRUE
T/F Universal environment settings for all users are kept by the administrator in /etc/profile.
-TRUE
What is the difference between the PATH and CDPATH environment variables?
-The CDPATH environment variable is a list of directories searched when using the cd command
What is the main difference between the at and batch commands?
-The commands of a batch job run sequentially one after another while the commands in at jobs may run in parallel.
A process inherits most of the environment of it's parent EXCEPT the following.
-User-defined local variables. (CORRECT) -The current directory from where the process was run (INCORRECT)
What is a shell alias?
-both -The shell supports aliases as a mechanism of assigning shorthand names for commands or for redefining commands to run with specific options
Which of the following is executed only once on login?
-login script
To display all variables available in the current shell use the _____ command.
-set
To enable vi-like in-line command editing capabilities you would enter _____ on the command line.
-set -o vi
To display a list of all evironment variables in the C shell, you would use the ____ command.
-setenv
If you wanted to export an environment variable in the C shell, you would enter the _____ command.
-setenv??
What does it mean when a process traps or "catches" a signal
-the process invokes a user-defined signal handling function.
Which one of the following files can Bash use as the rc script?
-~/.bashrc
What is the PID of init?
1
When running the ps command, system processes that have no controlling terminal are easily identified by the __________.
?
Match the process phase with its description. Exec
A child process overwrites its own image with the code and data of a new program
When is the PWD environment variable evaluated?
ALL of the ABOVE -Every time you spawn a shell -Every time the working directory changes
Match the ps command option with its significance. -e
All processes including user and system processes
If you ran the following command from the command line $ tar cvf /devfd0 *.doc and then wanted to repeat the command using .bak insteal of the .doc files, what would you enter on the command line?
Both of the above -!tar:s/doc/bak -^doc^bak
Match the command/shell operator with its action. -fg
Bring a background job to the foreground
Match the job control command with its significance- fg
Brings a job to foreground
Match the shell to its description. Korn Shell
Combined the best interpretive and programming features two shells
Match the crontab entry component to its description. (F)
Commands to be executed
Match the command/shell operator with its action. -nohup
Continues to run a process in the background even after logging out of the system
Match the process phase with its description. Fork
Creates a process by creating a copy of an existing process
Match the crontab entry component to its description. (C)
Day(s) of month [1-31]
Match the crontab entry component to its description. (E)
Day(s) of week (sunday: 0) [0-6]
Match the shell to its description. Bash shell
Developed to ultimately conform to the POSIX shell specification and is the best overall shell to use
Different processes can have the same Parent PID (PPID).
FALSE
Local shell variables get converted to an environment variable by using the environment variable command.
FALSE
Most process attributes are stored in the process table, a separate structure maintained on disk by the kernel.`
FALSE
T/F A process that is disassociated from the terminal can still write to the terminal or read from it.
FALSE
T/F A shell script also runs the login file.
FALSE
T/F Different processes can have the same Process-ID (PID).
FALSE
T/F Local user-defined variables are inherited from the parent process by the child process
FALSE
T/F The UNIX system communicates the existence of an event to a process through the use of traps.
FALSE
T/F The kill command is only used to kill a process.
FALSE
T/F cron is a one-time scheduler.
FALSE
The at, batch, and cron commands are ways to schedule jobs for later execution.
FALSE
The command "echo $$" displays the PPID of the shell.
FALSE
The expression $_ specifies the first argument to the previous command.
FALSE
The ~ acts as a shorthand representation of the home directory.
FALSE - delta sign
T/F The history command only lets you recall commands in the current session
FALSE -the history feature lets you recall previous commands -even commands executed in previous sessions
An rc (run command) script is executed only once on login.
FALSE- login profile is executed only once on login -An rc (run command) script is executed many times on login and subshell
If you must absolutely, positively kill a zombie process what step can you take?
First kill the parent (Enter kill pid from the command line where pid is the process ID of the zombie.)
Match the ps command option with its significance. -f
Full listing showing the PPID of each process
Match the shell to its description. C Shell
Had improved interpretive features, but wasn't suitable for programming
Match the crontab entry component to its description. (B)
Hour(s) [0-23]
Match the Shell Environment variable with it's meaning PS2
Secondary Prompt string
The S (State) column contains one of five possible states for a process. Match the following state codes with the process state description - s
Sleeping. Process is waiting for an event to take place
The S (State) column contains one of five possible states for a process. Match the following state codes with the process state description - T
Suspend. User pressed [Ctrl-z]
Match the job control command with its significance- suspend
Suspends a job
Match the job control command with its significance- [Ctrl-z]
Suspends the current foreground job
A directory stack is a convenient mechanism to use as a shortcut to switch between directories you visit frequently.
TRUE
In the shell, in order to prevent overwriting with the > and >>, you would enter the following command set -o noclobber on the command line.
TRUE
Shell variables are two types - local and environment.
TRUE
T/F /etc/profile is meant for storing global settings and is executed when a user logs in, and before her own profile is executed.
TRUE
T/F A process with no controlling terminal is more commonly known as a daemon.
TRUE
T/F A zombie process is a harmless dead child that reserves a process table slot.
TRUE
T/F Apart from ps, the top command also shows CPU usage in a more humanly readable form.
TRUE
T/F By default, Bash stores all previous commands in the file $HOME/.bash_history.
TRUE
T/F Environment variables like HOME and TERM are inherited from the parent process by the child process.
TRUE
T/F Processes within a process group all have the same process group-id (PGID).
TRUE
T/F Signals are the way in which the UNIX operating system can communicate the occurrence of an event to a process.
TRUE
T/F Solaris uses the A&T SVR4 version of the ps command while Linux uses the BSD version.
TRUE
T/F The PPID is the PID of the parent process.
TRUE
T/F The current directory is a process attribute inherited from the parent process by the child process.
TRUE
T/F The signal name for a kill -9 is SIGKILL.
TRUE
T/F To create a crontab entry, simply use your vi editor to create a file foo with an entry of your choice; then, use the following crontab command, crontab foo, to place the entry in the directory /var/spool/cron/crontabs.
TRUE
T/F To refer to the last argument of the previous command, I could use the shorthand notation $_
TRUE
T/F UNIX job control enables you to move jobs between foreground and background, suspend, continue, or kill them.
TRUE
T/F cron is a classic example of a daemon.
TRUE
The expression !* signifies all arguments to the previous command.
TRUE
The rc file is executed every time an interactive shell is called up.
TRUE
The signal name for a kill -15 is SIGTERM.
TRUE
There are two types of scripts which allow us to make any environment variable, alias, or set option we define permanent: a login script or an rc (run command) script.
TRUE
Using the nohup (no hangup) command allows a process to continue to run even after the user has logged out.
TRUE
The Bash shell looks for one of the three files, .bash_profile, .profile, and .bash_login, in the sequence specified, and identifies the one it spots first as its profile.
TRUE (CORRECT) -~/.bash_profile ~/.profile ~/.bash_login
Match the process state with its description-Ready
The normal state of process after creation
Which of the following is executed every time an interactive sub-shell is created?
rc script -An rc (run command) script, which is executed every time an interactive sub-shell is created
A process inherits most of the environment of it's parent EXCEPT the following.
user defined local variables
Is it possible to use the kill command to send to a process a signal other than the SIGKILL and SIGTERM signals?
yes
Which of the following characters acts as a shorthand representation of the home directory?
~ (delta)
Select the files which the bash shell can use as the login script of profile (INCORRECT)
~/.bash_logout ~/.bashrc ~/profile ~/.bash_profile ~/.bash_login
Match the process phase with its description. Wait
The parent process waits for the child to die, then picks up the exit status of the child process
Match the Shell Environment variable with it's meaning TERM
Type of terminal
An alias is unset with the _____ command.
UNALIAS
Match the Shell Environment variable with it's meaning SHELL
User's login shell and one invoked by programs having shell escapes
Match the shell to its description. Bourne Shell
Weak as an interpreter but had reasonbly str
Match the process state with its description- Zombie
What happens to the child process when the parent process doesnt wait for its child to die
Match the process state with its description- Orphan
What happens to the child when the parent process dies before the child process dies
Match the process state with its description- Suspended
When [Ctrl-z] is entered from the keyboard
Match the process state with its description- Running
When a process has control of the CPU
Match the process state with its description- Blocked
When a process waits for an I/O operation to comlete
The S (State) column contains one of five possible states for a process. Match the following state codes with the process state description- z
Zombie. Parent didn't wait for the child's death
If you wanted to display a machine's hostname in the PS1 prompt, what escape squence would you use
\h escape sequence
To display only environment variables available in the current shell use the _____ command.
env
To make a local variable visible in all child processes you would use the _____ command.
export
T/F A zombie process can be killed.
false
Match the Shell Environment variable with it's meaning HOME
home directory- the directory in which a user is placed on logging in
Match the command/shell operator with its action. -&
Runs a process in the background
The S (State) column contains one of five possible states for a process. Match the following state codes with the process state description - R
Runnable. The process simply needs to be selected for running
The S (State) column contains one of five possible states for a process. Match the following state codes with the process state description - o
Running on the CPU
Why is the kill -9 signal often a better approach to killing a process than the default kill -15 signal.
-Because the process can't ignore or trap a kill -9 signal.
What is the purpose of the SHELL environment variable?
-Both of the above? -SHELL displays your login shell. -When a program such as more and vi provide a shell escape to let you run a UNIX command
How is the home directory set?
-By an entry in the /etc/passwd file.
By default, Bash stores all previous commands in _____.
-$HOME/.bash_history
If you wanted to repeate the previous command you would type _____ at the command line.
!!
By default, Bash stores all previous commands in _____.
$HOME/.bash_history.
To run a process in the background, what character do you append to the end of the command line?
&
To display only local variables available in the current shell use the _____ command.
-
To display all variables available in the current shell use the _____ command.
-???
By convention, environment variable names are defined in _____.
-ALL of the above -uppercase
Match the job control command with its significance- kill
Kills a job
Match the Shell Environment variable with it's meaning PATH
List of directories searched by shell to locate a command
Match the job control command with its significance- jobs
Lists active jobs
Match the ps command option with its significance. -l
Long listing showing memory-related information
Match the crontab entry component to its description. (A)
Minute(s) [0-59]
Match the crontab entry component to its description. (D)
Month(s) [1-12]
Match the command/shell operator with its action. -bg
Moves a foreground job to the background
Match the job control command with its significance- bg
Moves a job to background
If you have the files .bash_profile and .profile in your home directory, will Bash read them both on login?
NO
Is it sufficient to simply submit a process background processing using the & operator if you want it to keep running in the background after you log off your system?
NO
Match the Shell Environment variable with it's meaning PS1
Primary prompt string
Match the ps command option with its significance. -a
Processes of all users excluding of processes not associated with a terminal