Linux Ch. 10
Which option for the cut command is used to specify a delimiter?
-d
Which option for the cut command is used to specify the field?
-f
Which option for the wc command will print the number of lines in a file?
-l
Which option of the head command will display only the first five lines of a file?
-n 5
Which option for the wc command will print the total number of words in a file?
-w
A pipe allows you to...
...send the output of one command to another.
The grep command...
...will display all the lines in a file containing the specified Regular Expression.
The command echo "text" > file.txt will not overwrite file.txt if it already exists. T/F?
False
Channel 2 is:
STDERR
Error messages generated by commands are sent where by default?
STDERR
A successful command may, or may not print output to STDOUT. T/F?
True
The command echo "text" > file.txt will create file.txt if it does not already exist. T/F?
True
The command echo "text" >> file.txt will not overwrite file.txt if it already exists. T/F?
True
The grep command can be used with glob characters. T/F?
True
Which of the following commands will append its output to output.file?
echo Testing >> output.file
Which of the following commands will display lines that contain either start or end?
egrep 'start|end' file.txt
Which of the following commands will display only lines that begin with start?
grep ^start file.txt
Which of the following commands will display only lines that begin with test?
grep ^test file.txt
Which of the following commands will direct error messages to the file, error.log?
ls /root 2> error.log
Which of the following commands can be used to scroll through a text file?
more & less
Which command can be used to print line numbers?
nl
Which command(s) can be used to sort the lines of list.file alphabetically and display it on the screen?
sort < list.file & cat list.file | sort