Chapter 6 - Redirection

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is an example head command using the -n option?

head -n 5 some.txt

What technique can be used to examine the output of any command that produces standard output?

piping to less

What does the cat command do if not given any arguments?

reads from stnadard input, which is the keyboard, and so it waits for user to type something

What does the cat command do?

reads one or more files and copies them to standard output (i.e., to the screen)

What does the tee command do when combined with a pipe?

reads standard input and copies it to both standard output and to one or more files

What method does the system provide for disposing of output from a command?

redirecting output to a special file called /dev/null

What is the order for redirecting standard output and standard error?

redirection of standard error must always occur after redirecting standard output or it doesn't work

What is a useful application of wc -l?

see the number of items in a sorted list

What does adding the -d option to uniq do?

shows the list of duplicates instead of getting rid of duplicates

What command is uniq often used in conjunction with?

sort

What happens if standard error appears in a single redirection before standard output?

standard error is directed to the screen

What are the first three file streams referred to as?

standard input, output, and error

What do filters do?

take input, change it somehow, and then output it

What does the grep -v option do?

tells grep to print only those lines that do not match the pattern

What does the head command print by default?

the first 10 lines of a file

What does the tail command print by default?

the last 10 lines of a file

What is the wc command used for?

to display the number of lines, words, and bytes contained in files

What is grep used for?

to find text patterns within files

What is one special use of the redirection operator?

using the redirection operator with no command (or a bogus command) preceding it will truncate an existing file or create a new, empty file

What notation can be used to redirect standard error?

2>

What symbol redirects standard output?

>

How does the shell reference the file streams?

as file descriptors 0, 1, and 2 (standard input, output, and error)

What can cat be used to do besides displaying short text files?

can be used to join files together

What capability do pipelines utilize?

capability of commands to read data from standard input and send to standard output

What is tee useful for?

capturing a pipeline's contents at an intermediate stage of processing

What is the command cat < file.txt equal to?

cat file.txt

What is an example command for joining numbered movie.mpeg fragments back together using cat and a wildcard?

cat movie.mpeg.0* > movie.mpg

What does the grep -i option do?

causes grep to ignore case when performing the search

What does using the < operator do?

changes the source of standard input from the keyboard to whatever is listed to the right of the operator

What does I/O redirection allow?

changing where output goes and where input comes from

What is the traditional method of redirecting both standard output and standard error at the same time?

command > destination 2>&1

What does cat do as soon as something is entered on the keyboard?

copies standard input to standard output

What is the syntax of a grep command?

grep pattern filename

What is the procedure for creating a short text file using cat?

$ cat > filename.txt file's text <Ctrl-D>

What is the syntax for suppressing error messages from a command?

$ command 2> /dev/null

What command makes a combined list of all the executable programs in /bin and /usr/bin, puts them in sorted order, and displays the resulting list?

$ ls /bin /usr/bin | sort | less

What command pipes a listing of the contents of the /usr/bin directory to an output of the last 5 lines?

$ ls /usr/bin | tail -n 5

What is the streamlined method for appending both standard output and standard error to a single file?

$>>

What is the more streamlined, single notation that can be used to redirect standard output and standard error simultaneously?

&>

How can you notify cat that it has reached end of file (EOF) on standard input?

Ctrl-D

What is another term for the /dev/null file?

a bit bucket

Where do common programs send their status messages to?

a special file called standard error (stderr)

Where do common programs send their results to?

a special file called standard output (stdout)

How does uniq work?

accepts a sorted list of data form either standard input or a single filename argument and, by default, removes any duplicates from the list

What does wc do if executed without command line arguments?

accepts standard input (until EOF issued)

What does the -n option in head and tail do?

allows specification of how many lines

What does the -f option in tail allow?

allows you to continue to monitor the file and allows new lines to be appended as they appear on the display (until you type Ctrl-C)

What can a program produce output on?

any of several numbered file streams

What does the redirection operator >> do?

appends redirected output to a file instead of overwriting the file from the beginning

What happens if either the >> or the > operator redirects output to a file that does not already exist?

file is created

What are commands chained together in a pipeline often referred to as?

filters

What is the default source of standard input?

keyboard

What does the -l option in wc do?

limits its output to report only lines

What does grep print out?

lines containing the pattern being searched for

What three numbers does wc print out?

lines, words, and bytes contained in a file

What is an example of redirecting standard output to a file?

ls /usr/bin > output.txt

What is the command for capturing the entire directory listing of /usr/bin to the file ls.txt before grep filters the pipeline's contents with the term "zip"?

ls /usr/bin | tee ls.txt | grep zip

What does a bit bucket do with the input it receives?

nothing

What does the pipe operator do?

pipes standard output of one command into the standard input of another

What is the pipe operator?

|


Set pelajaran terkait

Honors Geometry Fall Final (A star * means you should know how to prove the theorem as well)

View Set

Prevention questions for CH final

View Set