Quiz 2 (Linux)
Which of the following entries is maintained at the first line of the script?
#!/bin/sh
Complete the following command to redirect both standard output and a standard error from the bigprog program to the file out.txt. $_____ bigprog out.txt.
&>
The file that associates usernames with UID numbers in Linux is ___________. (Provide the complete path to the file.)
/etc/passwd
Where do log files reside on a Linux computer?
/var/log
Which of the following UIDs denotes the root user?
0
ASCII supports _____ unique characters (not including control characters).
128
Which of the following redirection operators appends a program's standard output to an existing file, without overwriting that file's original contents?
>>
What type of information will you find in /etc/passwd for ordinary user accounts? (Select all that apply.)
A user ID (UID) number The path to the account's default text-mode shell The path to the account's home directory
Which keystrokes invoke the pico or nano search function? (Select all that apply.)
Ctrl+W F6
Three keystrokes that can initiate a search-and-replace operation in nano are F14, __________, and __________.
Ctrl+\ Esc+R
Which keystroke invokes the pico or nano search function?
F6
A user types myscript laser.txt to run a script called myscript. Within myscript, the $0 variable holds the value laser.txt. (T/F)
False
Linux stores information on its groups in the /etc/groups file. (T/F)
False
Unicode is useful for encoding most European languages but not Asian languages. (T/F)
False
How would you remove two lines of text from a file when using vi?
In command mode, position the cursor on the first line and type 2dd.
What will be the output of the cat /etc/passwd command?
List of users created on a Linux computer
After using a text editor to create a shell script, what step should you take before trying to use the script by typing its name?
Set one or more executable bits using chmod
Which of the following results will be produced by specifying /bin/false to the shell for a user account in the /etc/passwd file?
The user will not be able to access the computer.
What is the purpose of conditional expressions in shell scripts?
They enable the script to take different actions in response to variable data.
The regular expression Linu[^x].*lds matches the string Linus Torvalds. (T/F)
True
To save a file and exit the vi text editor in command mode, type ____
ZZ
Which character represents the start of a line in a regular expression?
^
Which of the following tools is best suited to installing a software package and all of its dependencies on a Debian computer?
apt-get
Which of the following statements acts as a good replacement of the if-then-else-fi statement?
case
You're using bash, and you type emacs to launch the emacs editor. In this case, emacs is bash's ____________.
child
The __________ command can extract specified data fields from a file's records.
cut
The command that you use to read messages generated during the boot process and stored in the kernel ring buffer is the _____________ command.
dmesg
Which of the following statements is included in a case statement to denote its end?
esac
Which of the following commands executes very slowly and displays the full path of a file instead of just a filename?
find
Which of the following commands will you use to find a pattern in a file?
grep
Which of the following commands will print lines from the file world.txt that contain matches to changes and changed?
grep change[ds] world.txt
The gzip, bzip2, and xz programs all perform _________ compression, in which the uncompressed data exactly matches the original precompression data.
lossless
A(n) ________ environment means that a person cannot deny actions, and the sudo command helps establish this environment.
nonrepudiation
Most Linux distributions maintain information on what packages are installed in the ____________________. (Two words.)
package database
dWhich of the following formatting commands can be used to replace a string in a file?
sed
You want to run the command cat /etc/shadow as root, but you're logged in as an ordinary user. Which of the following commands will do the job, assuming that the system is configured to give you root access via the appropriate command?
sudo cat /etc/shadow
General system messages are likely to be found in /var/log/messages or /var/log/__________ , depending on your distribution.
syslog
Which of the following commands should be used to compress more than two files?
tar
You've received a tar archive called data79.tar from a colleague, but you want to check the names of the files it contains before extracting them. Which of the following commands would you use to do this?
tar tvf data79.tar
Which of the following commands lists a dynamic view of running processes?
top
While in vi's command mode, you can type __ to undo a change.
u
Which of the following commands outputs the total time the computer's been running?
uptime
To learn who is currently logged into the computer and what programs they're currently running, you can type ____.
w
Which command can be used to display the path names of the files executed in the current environment?
which
Which of the following operators is used to connect two or more than two commands on the Linux operating system?
|