Lab 6: Input Output Redirection
Objective Focus
- Understand and use essential tools
- Create and edit text files
- Use input-output redirection (>, », |, 2>, etc.)
Official RHCSA EX200 Exam Objectives
Looking At File Content as Terminal Output
- concatenate files and print on the standard output
- allows a user to partially display content of a file
- has less options than $ less
- output the first part of files, default is first 10 lines
- output the last part of files, default is last 10 lines
Understanding Input and Output Redirection
| Input | Output | Error |
|---|---|---|
| < | >, » | 2> |
| $ out < in | $ in > out | $ in 2> errout |
| $ in » out |
Example Use Cases
Download sample file here!
How to use pipes “|” in Linux
Using the “|” character is a form of redirection. It allows you to take output from one command to another.
Example Use Cases
The above example shows us how we use available tools on the system for redirection. And how We could also redirect this output to a text file to share.
Redirections are very important to completing daily tasks in linux!
That’s it for lab 6!