This is a timed quiz.
You have 40 minutes to complete the 21 questions in this quiz.
You type a command into bash and pass a long filename to it, but after you enter the command, you receive a File not found error message because of a typo in the filename. How might you proceed?
Retype the command, and be sure you type the filename correctly, letter by letter
Retype the command, but press the Tab Key after typing a few letters of the long filename to ensure that the filename is entered correctly
Press the Up arrow key, and use bash's editing features to correct the typo.
Any of the above
None of the above
Which command will display the last lines of the text file file1?
head -b file1
head --bottom file1
head -v file1
tail file1
tail -n 1 file1
Carlos has text file named guest_list containing 12 lines. She executes the following command. What is the result? #split -4 guest_list gl
The first four columns in the text are written to new files glaa, glab, glac, and glad
The first four columns in the text are written to new files aagl, abgl, acgl and adgl.
The lines of guest_list are evenly divided among new files glaa, glab, glac, and glad
The lines of guest_list are evenly divided among new files glaa, glab and glac.
The lines of guest_list are evenly divided among new files aagl, abgl, acgl and adg
Which one of the following commands could be used to change all upper-case characters to lowercase in the middle of a pipe?
grep
egrep
wc
tr
pr
What command can display the contents of a binary file in a readable hexadecimal form? Select one.
xd
hd
od
Xd
dump
You want to store the standard output of the ifconfig command in a text file (file.txt) for future reference, and you want to wipe out any existing data in the file. You do not want to store standard error in this file. how can you accomplish these goals?
ifconfig < file.txt
ifconfig >> file.txt
ifconfig > file.txt
ifconfig | file.txt
ifconfig 2> file.txt
What is the effect of the following command? #myprog &> input.txt
Standard error to myprog is taken from input.txt
Standard input to myprog is taken from input.txt
Standard output and standard error from myprog are written to input.txt
All of the above
How many commands can you pipe together at once?
2
3
4
16
>16
Which of the following commands will number the lines in aleph.txt (Select three.)
fmt aleph.txt
nl aleph.txt
cat -b aleph.txt
cat -n aleph.txt
od -nl aleph.txt
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
sed change[d-s] world.txt
od "change'd|s" world.txt
cat world.txt changes changed
find world.txt "change(d|s)"
Which of the following regular expressions will match the strings dog, dug, and various other strings but not dig?
d.g
d[ou]g
d[o-u]g
di*g
d.ig
Which of the following files, located in the user home directory, is used to store the Bash History?
.bash_history
.bash_histfile
.history
.bashrc_history
.history_bash
Which of the following shell redirections will write standard output and standard error output to a file named filename?
2>&1 >filename
>filename 2>&1
1>&2>filename
>>filename
1&2>filename
Which variable defines the directories in which a Bash shell searches for executable commands?
BASHEXEC
BASHRC
PATH
EXECPATH
PATHRC
Which of the following commands will send output from the program myapp to both standard output (stdout) and the file file1.log?
cat < myapp | cat > file1.log
myapp 0>&1 | cat > file1.log
myapp | cat > file1.log
myapp | tee file1.log
tee myapp file1.log
Which of the following commands replaces each occurrence of 'bob' in the file letter with 'Bob' and writes the result to the file newletter?
sed '/bob/Bob' letter > newletter
sed s/bob/Bob letter > newletter
sed 's/bob/Bob' letter > newletter
sed 's/bob/Bob/g' letter > newletter
sed 's/bob, Bob/'' letter > newletter
What command will generate a list of user names from /etc/passwd along with their login shell?
column -s : 1,7 /etc/passwd
chop -c 1,7 /etc/passwd
colrm 1,7 /etc/passwd
cut -d: -f1,7 /etc/passwd
Which of the following statements is correct regarding the command foo 1>bar?
The stdout from the command foo is appended to the file bar.
The stdout from the command foo overwrites the file bar.
The command foo receives its stdin from the file bar.
The command foo receives its stdin from the stdout of the command bar.
The stderr from the command foo is saved to the file bar.
Which of the following commands is implemented as an internal command in bash?
cat
less
tee
sed
echo
A text-mode program, verbose, prints a lot of bogus "error" messages to standard error. How might you get rid of those messages while still interacting with the program?
verbose | quit
verbose &> /dev/null
verbose 2> /dev/null
verbose > junk.txt
quiet-mode verbose
Which of the following commands will change all occurrences of dog in the file animals.txt to mutt in the screen display?
sed -s "dog" "mutt" animals.txt
grep -s "dog || mutt" animals.txt
sed 's/dog/mutt/g' animals.txt
cat animals.txt | grep -c "dog" "mutt"
fmt animals.txt | cut 'dog' > 'mutt'