linux:bash
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| linux:bash [2026/05/15 13:12] โ [STANDARD INPUT and OUTPUT] v1ctor | linux:bash [2026/05/15 13:30] (current) โ [REDIRECTS vs PIPES] v1ctor | ||
|---|---|---|---|
| Line 74: | Line 74: | ||
| + | ==== REDIRECTS vs PIPES ==== | ||
| + | |||
| + | The core difference: redirects connect a stream to a file (a redirect always has a file on one side). Pipes connect one process to another process. | ||
| + | |||
| + | |||
| + | Pipes: process โ process: | ||
| + | <code bash> | ||
| + | cmd1 | cmd2 # Takes cmd1's stdout and feeds it directly into cmd2's stdin. No file involved | ||
| + | ls | grep " | ||
| + | </ | ||
| ==== STANDARD INPUT and OUTPUT ==== | ==== STANDARD INPUT and OUTPUT ==== | ||
| Line 83: | Line 93: | ||
| hello # Stdin is connected to the terminal, you can type there. | hello # Stdin is connected to the terminal, you can type there. | ||
| hello # Stdout - cat prints it right away after you pressed enter. | hello # Stdout - cat prints it right away after you pressed enter. | ||
| + | </ | ||
| + | |||
| + | |||
| + | ** < redirects Stdin** | ||
| + | <code bash> | ||
| + | cat < foo.txt | ||
| + | bar | ||
| </ | </ | ||
linux/bash.1778850756.txt.gz ยท Last modified: by v1ctor
