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?
>
How do you redirect output so that it is appended to the end of a file, adding to the end of a file?
> >
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
You have a file named greekfile with the following contents:
WELCOME TO GeeksforGeeks
How will you uppercase all of the letters?
cat greekfile | tr “[a-z]” “[A-Z]”
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.