Topic 5 - Unix Input-Output Redirection Flashcards
During execution of a program, where are the input/output/errors directed to?
They're directed from/to: Standard Output (stdin) Standard Output (stdout) Standard Error (stderr)
Where can these outputs be redirected to?
Any file or device other than the terminal
What is the redirect output symbol?
>
What is the append output symbol and what does it do?
> >
- instructs the shell to add the new data to the end of a file, accumulating on any data that was already there
Can standard output be redirected independently from standard error?
Yes
How do you redirect in bourne-style shells?
standard error = 2>
standard output = 1> or simply >
Can use 2>&1 to re-direct to the same name file
How you append in bourne-style shells?
2» instead of 2>
1» instead of 1>
» instead of >
How do you redirect in C-style shells?
redirected together to a file using “>&”;;
Independently: two files as follows:
( cat file3 file2 > output_file ) “>&”; error_file
How do you append in C-style shells?
> > &; instead of >&;
|»_space; instead of >
What is the Redirect Input symbol ?
less than sign
Standard input can also be redirected from the text to be written immediately after the command using the ______.
two less than signs
What does the command tr do?
means translate: reads from standard input, modifies selected characters in the read input, writes the results to standard output.
What does the command grep do?
Global Regular Expression and Print. searches text files for matching pattern and prints matched patters to standard output.
What is the difference between wildcards and regex?
File name wildcards are interpreted and matched by shells. Regex are interpreted and matched by special utilities.
What does the wc command do
prints the number of lines,w words, and bytes in a file.