Shared Flashcard Set

Details

Ch 12 Redirection and Piping
Unix The Textbook 2nd Edition
12
Computer Science
Undergraduate 2
11/01/2014

Additional Computer Science Flashcards

 


 

Cards

Term
What three files are automatically opened by the kernel for every command for the command to read input from and send its output and error messages to.
Definition
These files are known as standard input (stdin), standard output(stdout), and standard error(stderr).
Term
The input, output, and errors of a command can be redirected to other files by using these facilities in UNIX.
Definition
file redirection facilities
Term
Input to 'command' comes from 'input-file' instead of from the keyboard
Definition
command < input-file
Term
Send output of 'command' tot he file 'output-file' instead of tot he monitor screen
Definition
command > output-file
Term
Input to 'command' comes from 'input-file' instead of the keyboard, and the output of 'command' goes to 'output-file' instead of the display screen
Definition
command< input-file > output-file
Term
Give the file descriptors for standard input, standard output, and standard error.
Definition
0, 1, and 2 respectively
Term
Error messages generated by 'command' and sent to stderr are redirected to 'error-file'
Definition
command 2>error-file
if error-file exists it is overwritten, otherwise it is created
Term
redirect stdout and stderr in one command
Definition
cat lab1 lab2 1> cat.output 2>&1
Term
redirect stdin, stout, and stderr in one command
Definition
command 1> output-file 0error-file
Term
sort lines in a file called students and store the sorted file in students.sorted
Definition
sort 0< students 1> students.sorted 2>sort.error
Term
Write a command that counts the number of characters, words, and lines in a file called 'memo' in your pwd and writes these values into a file 'memo.size'. If the command fails, the error message should to go to a file 'error.log'. Use i/o and error redirections.
Definition
wc 0error.log 1> memo.size
Term
Write a shell command to send the contents of a 'greetings' file to 'doe@domain.com' by using the mail command. If the mail command fails, the error message should go to a file 'mail.errors'. use input and error redirection
Definition
mail doe@daomin.com 2>mail.errors
Supporting users have an ad free experience!