Tutorial by Examples

Using a pipe makes the output of a command be the input of the next one. ls -1 | grep -c ".conf" 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 ...
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: su -c ifconfig | tee ~/results-of-ifconfig.txt Only ifconfig runs as root.
&& 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. [ a = b ] && echo "yes" || echo "no" # if you want to run more commands within a logical c...
A semicolon separates just two commands. echo "i am first" ; echo "i am second" ; echo " i am third"
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. find . -type f -a -iname '*.mp3' | \ while read filename; do mute --noise &quot...

Page 1 of 1