| Start |
|---|
| Counting a text pattern ocurrence Using a pipe makes the output of a command be the input of the next one. In this case the ouput of the ls command is used as the input of the grep command. The result will be the number of files that include ".conf" in their name. This can be used to contruct chains of subsequent commands as long as needed: |
| transfer root cmd output to user file Often one want to show the result of a command executed by root to other users. The tee command allows easily to write a file with user perms from a command running as root: Only ifconfig runs as root. |
| logical chaining of commands with && and || && chains two commands. The second one runs only if the first one exits with success. || chains two commands. But second one runs only if first one exits with failure. |
| serial chaining of commands with semicolon A semicolon separates just two commands. |
| chaining commands with | The | takes the output of the left command and pipes it as input the right command. Mind, that this is done in a subshell. Hence you cannot set values of vars of the calling process wihtin a pipe. |
Read Article
https://develop.horje.com/learn/1434/reference