| Bash |
$ vim ~/.bashrc
|
| ZSH |
$ vim ~/.zshrc
|
| Fish |
$ vim ~/.config/fish/config.fish
|
| > | send output to file (overwriting and destroying whatever is in the file already) |
|
$ echo "Write output to file" > example.txt
| |
| >> | append output to file |
|
$ echo "Append this to file" >> example.txt
| |
| < | take input from file |
|
$ cowsay < example.txt
| |
| 2> | send error messages to file (overwriting). (This means that errors can be directed separately from normal output.) |
|
$ rm -vf folder1 file1 > out.txt 2> err.txt
|
| \ | escapes itself and other specials |
| * | stands for anything (including nothing) |
|
$ find ex*.txt
| |
| ? | stands for any single character |
|
$ find ex?mple.txt
| |
| [] | encloses patterns for matching a single character |
|
$ find ex[abc]mple.txt
| |
| () | runs the contents of the parentheses in a sub-shell |
| ; | terminates a command pipeline - use it to separate commands on a single line |
| ' ' | The contents of the single quotes are passed to the command without any interpretation. |
|
$ find '(echo abc)'*
(echo abc).txt | |
| ` ` | The contents of the backquotes are run as a command and its output is used as part of this command |
| "" | The contents of the quotes are treated as one argument; any specials inside the quotes, except for $ and ``, are left uninterpreted. |
|
$ cd "untitled folder"
| |
| | | Pipes allow you to send the output of a command to another command. |
| & | Run a command in the background. |
|
$ cowsay &
| |
| && | Only execute the second command if the first one was successful. |
| || | Only execute the second command if the first one was unsuccessful. |
| >> | These symbols are used for redirection. |
| !! | Repeat the last command |
|
$ sudo !!
| |
| !* | Change command keep all arguments |
| ^ | Quick history substitution, changing one string to another. |
| # | Turns the line into a comment; the line is not processed in any way. |