1. Redirection
Redirection is a common instruction that allows a computing system to change the stdout of a standard stream to a custom location. The location can be specified through > operator, and it is a job to save the results performed through the command as a file.
A simple redirection operator is a task of erasing data from an existing file and rewriting the contents. To add new data to existing data, we need to use the >> operator.
user@host: /home$ [command] > [filename]
user@host: /home$ [command] [file1] >> [file2]
2. Pipeline
Pipeline delivers standard outputs from different processes as standard inputs, enabling the computation of complex instructions. Creating pipelines and linking commands allows complex commands to be generated using only programs that exist in Unix-like systems.
Below is pipeline to check the number of directories existing in /bin file :
user@host: /home$ ls -l /bin | tail -n+2 | wc -l
We use $$ operator to output results while performing two commands simultaneously, as opposed to performing processes in conjunction.
3. Null Device
A null device is a device file in which some operating systems discard all data that is being recorded, but report a successful write operation. When it exists in the /dev/null file and we don't want to see what's being printed, stdout the output here and we won't see anything.
'OS > Linux' 카테고리의 다른 글
[venv] How to use Virtual Environment with Built-in venv module (0) | 2022.10.24 |
---|---|
[pipenv] Easily Manage Packages and Virtual Environments (0) | 2022.10.17 |
[python] Python Scripts (0) | 2022.09.22 |
[Theorem] Standard Streams/File Descriptors (0) | 2022.09.22 |
[Theorem] Owner/Permissions (0) | 2022.09.22 |