Midterm Review For NOS 120
Command to concatenate files and print on the standard output
cat
Which term describes the name of a program to run? Argument Command Option Prompt
command
Which Bash shortcut or command displays the list of previous commands? Pressing Tab !string !number history Pressing Esc+.
history
Which item or file represents the location of the user's personal files? home directory login shell /etc/passwd /etc/group
home directory
Which item represents the program that provides the user's command-line prompt? primary shell home directory login shell command name
login shell
Which directory is the top of the system's file system hierarchy? /etc / /home/root /root
/
Which directory contains persistent, system-specific configuration data? /etc /root /run /usr
/etc
Which directory contains installed software programs and libraries? /etc /lib /usr /var
/usr
Which answer sends output to a file and sends errors to a different file? >file 2>file2 >file 1>file2 >file &2>file2 | tee file
>file 2>file2
Which item represents a number that identifies the group at the most fundamental level? primary group UID GID groupid
GID
Which term describes the part of the command line that adjusts the behavior of a command? Argument Command Option Prompt
Option
Which term describes the visual cue that indicates an interactive shell is waiting for the user to type a command? Prompt Argument Command Option
Prompt
What command can be used to display the last five lines of a text file? a. tail -5 b. stop -5 c. head -5 d. end -5
a. tail -5
Which of the following is the first field of the /etc/passwd file? a. GID b. username c. password d. UID
b. username
Which of the following commands will send the output of the cat command to the grep command to be filtered? a. cat /etc/passwd @ grep jsmith b. cat /etc/passwd > grep jsmith c. cat /etc/passwd | grep jsmith d. cat /etc/passwd >> grep jsmith
c. cat /etc/passwd | grep jsmith
Which of the following commands will create a symbolic link named foo.txt to an original file named bar.txt a. ln -h foo.txt bar.txt b. ln foo.txt bar.txt c. ln -s bar.txt foo.txt d. ln bar.txt foo.txt
c. ln -s bar.txt foo.txt
Command to change the working directory
cd
Which command will change the working directory to /tmp if the current working directory is /home/student? cd tmp cd .. cd ../../tmp cd ~tmp
cd ../../tmp
Which command will always change the working directory to /bin? cd bin cd /bin cd ~bin cd -bin
cd /bin
Which command displays the absolute path name of the current location? cd pwd ls ~ ls -d
pwd
Which of the following commands will delete a directory and all of the files contained within it? (Choose all that apply.) a. rmdir -rf olddir b. rmdir olddir c. rm -rf olddir d. rm olddir
rm -rf olddir
Separate from manual pages, the GNU Project developed a different online documentation system, known as GNU Info. True or False
true
Vim is a text editor to edit all kinds of plain text. True or False
true
Which directory contains user home directories? / /home /root /user
/home
Which answer displays output to a terminal and ignores all errors? &>file 2> &>file 2>/dev/null 1>/dev/null
2>/dev/null
Which directory contains temporary files? /tmp /trash /run /var
/tmp
Which pattern will match only filenames beginning with "b"? b* *b *b* [!b]*
b*
Command to list directory contents
ls
Which term describes the interpreter that executes commands typed as strings? Command Console Shell Terminal
shell
The pinfo reader is more advanced than the original info command. True or False
true
Which Bash shortcut or command re-executes a specific command in the history list? Pressing Tab !number !string history Pressing Esc+.
!number
Which Bash shortcut or command separates commands on the same line? Pressing Tab history ; !string Pressing Esc+.
;
Which item represents a number that identifies the user at the most fundamental level? primary user UID GID username
UID
Command to print the name of the current/working directory
pwd
A program for securely logging into a remote machine and for executing commands on a remote machine. httpd ps ssh more
ssh
Which command will switch to the root user? set root elevate sudo -i be root
sudo -i
Which term describes an interface that provides a display for output and a keyboard for input to a shell session? Console Virtual Console Shell Terminal
terminal
Which directory contains dynamic data, such as for databases, logs, and websites? /etc /run /usr /var
/var
Which answer sends output and errors to the same file ensuring existing file content is preserved? >file 2>file2 &>file >>file 2>&1 >>file 1>&1
>>file 2>&1
Which term describes the part of the command line that specifies the target that the command should operate on? Argument Command Option Prompt
Argument
Which of the following commands can be used to delete a user account? :a. expireuser b. rmuser c. userdel d. deluser
c. userdel
Command to print or echo content to stdout
echo
Command to make a directory
mkdir
Which term describes the hardware display and keyboard used to interact with a system? Physical Console Virtual Console Shell Terminal
physical console
Which Bash shortcut or command is used to complete commands, file names, and options? ; !number history Pressing Tab Pressing Esc+.
pressing tab
What is the fourth field of the /etc/passwd file? home directory UID login shell primary group
primary group
Which pattern will match only filenames where the first character is not "b"? b* *b *b* [!b]*
[!b]*
Which pattern will match only filenames that begin with an uppercase letter? ^?* ^* [upper]* [[:upper:]]* [[CAP]]*
[[:upper:]]*
Which command is used to return to the current user's home directory, assuming the current working directory is /tmp and their home directory is /home/user? cd cd .. cd . cd * cd /home
cd
Which Bash shortcut or command is used to re-execute a recent command by matching the command name? Pressing Tab !number !string history Pressing Esc+.
!string
Which answer discards all messages normally sent to the terminal? >file 2>file2 &>/dev/null &>/dev/null 2>file &>file
&>/dev/null
Which answer sends both output and errors to a file, creating it or overwriting its contents? | tee file 2 &>file 1 &>file &>file
&>file
Which pattern will match only filenames that contain a number? *#* *[[:digit:]]* *[digit]* [0-9]
*[[:digit:]]*
Which pattern will match only filenames ending with "b"? b* *b *b* [!b]*
*b
Which pattern will match all filenames containing a "b"? b* *b *b* [!b]*
*b*
Which item or file represents the location of the local group information? home directory /etc/passwd /etc/GID /etc/group
/etc/group
Which item or file represents the location of the local user account information? home directory /etc/passwd /etc/UID /etc/group
/etc/passwd
Which directory is the administrative superuser's home directory? /etc / /home/root /root
/root
Which directory contains non-persistent process runtime data? /tmp /etc /run /var
/run
Which directory contains regular commands and utilities? /commands /run /usr/bin /usr/sbin
/usr/bin
Which of the following represents stderr at the command line when used for redirection? 0 1 3 2
2
Which answer saves output to a file and discards error messages? &>file | tee file 2> /dev/null > file 1> /dev/null > file 2> /dev/null
> file 2> /dev/null
Which pattern will match only filenames at least three characters in length? ???* ??? \3* +++* ...*
???*
Which Bash shortcut or command jumps to the beginning of the command line? !number !string Pressing Ctrl+LeftArrow Pressing Ctrl+K Pressing Ctrl+A
Pressing Ctrl+A
Which Bash shortcut or command is used to clear characters from the cursor to the end of the command line? Pressing Ctrl+LeftArrow Pressing Ctrl+K Pressing Ctrl+A ; Pressing Esc+.
Pressing Ctrl+K
Which Bash shortcut or command jumps to the beginning of the previous word on the command line? Pressing Ctrl+LeftArrow Pressing Ctrl+K Pressing Ctrl+A !string !number
Pressing Ctrl+LeftArrow
Which Bash shortcut or command copies the last argument of previous commands? Selected Answer: Pressing Esc+. Answers: Pressing Ctrl+K Pressing Ctrl+A !number Pressing Esc+.
Pressing Esc+.
What directory under / contains the log files and spools for a Linux system? a. /boot b. /var c. /usr d. /opt
b. /var
Levi wants to run 5 commands sequentially, but does not want to create a shell script. He knows that each command is going to take approximately 20 minutes to run individually. However, he would like to go to lunch 15 minutes from now. He knows that he can type all of the commands on the same line and separate them with a certain character to run them sequentially. Which character can he type after each command to have them run one after the next without requiring further input from him? a. a comma b. a pound sign c. a semicolon d. a colon
c. semicolon
Which command will always return you to the working directory used prior to the current working directory? cd - cd -p cd ~ cd ..
cd -
Which command will always change the working directory to the parent of the current location? cd ~ cd .. cd ../.. cd -u1
cd ..
Which command will always change the working directory up two levels from the current location? cd ~ cd ../ cd ../.. cd -u2
cd ../..
Which command lists files in the current location, using a long format, and including hidden files? llong ~ ls -a ls -l ls -al
ls -al
Command to access the interface to the system reference manuals (i.e., show the manual pages)
man
To display a list of keyword-matching man page topics with section numbers, a keyword search of man pages is performed with which option? man -s keyword man -l keyword man -k keyword man -f keyword
man -k keyword
Manual pages are shipped as part of the software packages for which they provide documentation, and the pages can be accessed from the command line by using the man command. true or false
true
One source of documentation that is generally available on the local system are system manual pages or man pages. true or false
true.
Which term describes one of multiple logical consoles that can each support an independent login session? Physical Console Virtual Console Shell Terminal
virtual console
Which answer sends output to both the screen and a file at the same time? &>/dev/null >file 2>file2 | tee file | < file
| tee file