LINUX TEST 3
Which character begins a comment in many common configuration files, such as /etc/fstab? ! # / ( "
#
The string _______, located at the start of the file, identifies a script as a Bash script.
#!/bin/bash
You're writing a script that should accept two arguments, a username and a year, specified in that order on the command line. What variable would you use to access the year? $1 $year $annum $2 $B
$2
What keystroke deletes a line of text when using nano? Ctrl+C Ctrl+X Ctrl+Y Ctrl+K Ctrl+D
Ctrl+K
When should you use the root account? When you need extra computational speed Only when you're the sole user of the computer When you need to diagnose a problem with the computer Only when running untrusted programs. Only when necessary to perform administrative tasks
Only when necessary to preform admininstrative tasks
Being a member of the _____ group gives you extra privileges, which often include the right to use sudo.
wheel
A _____ loop executes for as long as its condition is true.
while
Spaces and tabs are examples of ________, which separate elements in many configuration files
whitespace
You can type _____ to learn your current username and nothing more?
whoami
You use the ___ character to separate two strings, either of which should match, in an extended regular expression. ! ^ | ~
|
What types of information does the id command provide? (Select all that apply.) Your UID number Your default group Your current group All your group memberships Your username
- Youe UID number -Your current group - All your group memberships - Your username
The _________ option to tar causes it to back up only the specified low-level filesystem; if another filesystem is mounted within the directory you say to back up, those files will be ignored.
--one-file-system
Which option to zip can you use to encode symbolic links as such rather than including the linked-to file? -i -l -s --links --symlinks
--symlinks
Which options to find can you use to locate files owned by a particular user? (Select all that apply.) -uid -name -id -user -u
-uid -user
Which of the following files defines Linux groups? /etc/groups /etc/grp /etc/gids /etc/group
/etc/group
To append a program's standard error to an existing file without deleting its contents, you should use the ____ redirection operator.
2>>
The character that separates fields on each line of /etc/passwd is ___.
:
You're working in Vi and, after having saved your current file, you want to load a new one. You can do so by typing ____ newfile.txt from command mode.
:e
Which of the following redirection operators appends a program's standard output to an existing file, without overwriting that file's original contents? | 2> &> > >>
>>
What type of information will you find in /etc/passwd for ordinary user accounts? (more than one answer) A user ID (UID) number A complete listing of every group to which the user belongs The path to the account's home directory The path to the account's default GUI desktop environment The path to the account's default text-mode shell
A user ID (UID) number The path to the accounts home directory The path to the account's default text-mode shell
Each question should start with 'Q:' or be successively numbered. - If there are choices, the first choice should start with 'A.'. - Each successive choice should start with the next letter and a period. - Each choice should be on a single line, but it is OK if it is longer than will fit in the text area and it wraps on its own.
Each successive choice should start with the next letter and a period.
The gzip program generally produces more compact compressed files than does the bzip2 program. True False
False
True or false: All Bash scripts must be built from functions. True False
False
True or false: All user accounts are necessarily defined in /etc/passwd and /etc/shadow. True False
False
True or false: It's impossible to run a Bash script if it hasn't had an executable bit set on its file. True False
False
True or false: The /etc/group file supports linking each user to a maximum of one group. True False
False
True or false: To save a text file in Vi, you should press Ctrl+S. True False
False
What is the purpose of the system account with a UID of 0? It is the system administration account It is the account for the first ordinary user Nothing; UID is left intentionally undefined It varies from one distribution to another It is a low-privilege account that is used as a default by some servers
It is the system admin account
Which of the following pieces of information on user accounts is not normally stored in the /etc/passwd file on modern Linux distributions? The account's default shell The account's default GID number The account's UID number The account's username The account's password
The account's password
ASCII is limited to 72 characters—one for each uppercase letter, lowercase letter, digits, and ten punctuation symbols. True False
True
HTML is an example of a formatted text file format. True False
True
Linux supports two types of text-mode output to the screen, which you can send to separate files or display devices. True False
True
Nano is an extended variant of pico. True False
True
True or false: A carat (^) represents the start of a line in regular expressions. True False
True
True or false: The lowest UID number used for user accounts on Linux systems varies from one installation to another. True False
True
True or false: The who command reveals the remote computer from which users have logged in, when they've logged in remotely. True False
True
True or false: You can record the output of a command in a variable by enclosing the command in backticks, as in myout=`whoami`. True False
True
True or false: You can use common external commands, such as find and sed, in your Bash scripts. True False
True
You can use grep to search for strings in binary files. True False
True
In pico or nano, you can paste text that you've cut or copied earlier by pressing Ctrl+____.
U
A text encoding method that can use single- or multiple-byte encodings to store text using most human alphabets is known as _________.
Unicode
Which of the following text editors runs as a text-mode program when launched in text mode but also provides a GUI version for use in a GUI environment? emacs NEdit nano KWrite Vi
emacs
What Bash scripting keyword terminates a case statement? esac end } term casend
esac
You're writing a script that will be called by other scripts. You want to signal abnormal termination of your script by passing a value of 8 to the external script under some circumstances. What command can you use in your own script to do this? die 8 term 8 exit 8 pass 8 send 8
exit 8
What keystroke creates a new blank line immediately below the current one, when typed in Vi's command mode? ZZ i o :wq 1yy
o
What command can you use to retrieve user input into a variable in a Bash script? inline read get getline input
read
You can type ______ to acquire root privileges that persist across multiple commands.
su
You want to run the command iptables -L as root, but you are logged in as a mortal user. Which of the following commands will do the job, assuming the system is configured to give you root access via the appropriate command? sudo iptables -L root iptables -L passwd iptables -L su iptables -L admin iptables -L
sudo iptables -L
You can use the ____ command to count the characters, words, and lines in a text file.
wc