Linux Review 1-3
Which of the following will display the file "names" with line numbers at the beginning of each line? ls -n names echo -c names cat -d names cat -n names
cat -n names
Which of the following Linux commands will display a list of files in the current working directory? pwd ls dir set *
ls dir
Which of the following is an absolute pathname? /home/resume home/resume \resume . ./resume
/home/resume
A relative pathname is a pathname of a file or directory starting from: The root directory The user's home directory The user's current working directory The drive letter (such as C) designating file system
The user's current working directory
The tac command displays the contents of a file in reverse order, last line first and first line last. True False
True
In Linux, since there can be multiple file systems, each has a root (/) directory. True False
False
The command tail names will allow you to display the last 20 lines in the file "names" True False
False
The less command offers less functionality than the more command. True False
False
After typing the ls -a command, you notice a file whose filename begins with a dot ( . ). What does this mean? It is a binary file It is a hidden file It is a system file It is a special device file
It is a hidden file
After typing the ls -F command, you notice a file whose filename ends with an asterisk ( * ). What does this mean? It is a hidden file It is a linked file It is an executable file
It is an executable file
Which command would a user type on the command line to find out the current directory in the directory tree? Dir Cd Where Pwd
Pwd
A special device file is used to _________________? Enable proprietary custom-built devices to work with Linux Represent hardware devices such as hard disk drives and ports Keep a list of device settings specific to each individual user Store information necessary for special need users
Represent hardware devices such as hard disk drives and ports
Which command searches for and displays any text contents of a binary file? Text Od Strings Less
Strings
In addition to any upper or lower case letter and numeric digits, the use of the underscore, the dash, and the period are permitted in file names True False
True
Using wildcard metacharacters, how can you indicate a character that is not an a or b or c or d? ^[a-d] Not [a-d] [!a-d] !a-d
[!a-d]
A user typed in the command pwd and saw the output: /home/jim/sales/pending. How could that user navigate to the /home/jim directory? Cd .. Cd /home/jim Cd ./. Cd /jim Cd ../..
cd /home/jim cd ../..
The command: grep -i "Unix OS I" Orientation will display all lines in the Orientation file which Which include the words "Unix OS I" Which include the words "unix os I" Which include the words "unix OS I" Which include the words "UNIX OS I" All the above
All the above
A regular expression will _________________ Allow you to enter an arithmetic expression and provide the solution Allow you to specify a certain pattern of text with a text document Display the results of the evaluation of a boolean expression None of the provided answers is correct
Allow you to specify a certain pattern of text with a text document
The Linux file system hierarchy uses letters (C:, D:, E:, etc) to designate different file systems in much the same manner as Windows. True False
False
What will the following wildcard regular expression return: file[a-c] ? Filea Filea, filec Filea, fileb, filec Fileabec
Filea, fileb, filec
If "resume" is the name of a file in the home directory off the root of the filesystem and your present working directory is home, what is the relative name for the file named resume? /home/resume /resume Resume \home\resume All of the above are correct
Resume
A user types the command head /poems/mary. What will be displayed on the terminal screen? The first line of the file mary The header for the file mary The first 20 lines of the file mary The first 5 lines of the file mary The first 10 lines of the file mary
The first 10 lines of the file mary
The grep command is used to find lines in a text file which match a common regular expression. True False
True
If a user's current directory is /home/mary/project1, which command could she use to move to the etc directory directly under the root? cd .. cd /home/mary/etc cd etc cd /etc cd \etc
cd /etc