September 2015
Intermediate to advanced
200 pages
6h 40m
English
If you just type single commands and do nothing else with them, you’ll see the output printed to your screen. The shell also lets you send this output elsewhere, though, using two important techniques: first by stream redirection and second by creating pipelines.
We can redirect streams using > and >> after the command whose output we want to redirect. The first will write the output to a file, clearing the file’s contents if it exists. The second will also write to a file, but will append to the existing content if the file already exists.
To revisit the ls example:
| | user@computer:~ $ ls -l Pictures > files.txt |
| | |
| | user@computer:~ $ cat files.txt |
| | -rw-r--r-- 1 rob staff 75130 2 May ... |
Read now
Unlock full access