First page Back Continue Last page Overview Graphics
First things first: Standard files
Standard Output
- Output of a shell command, e.g. default location of echo or print statements. Can be redirected to a file with > operator, which overwrites its destination
- echo “Hello, World!”
echo “Hello, World!” > file.txt
cat file.txt > file2.txt
>> operator appends instead of overwrites
Standard Input
- Where many commands get their data from.
- If not provided, bash reads stdin from the terminal
- One line processed at a time
- use ^D on a line by itself to indicate end of file.
- cat > file3.txt
- Redirect with < operator, e.g. cat < file2.txt
What does the “cat” command when run alone? Why?
Notes: