Tapping the power of Unix

Wildcards, redirection to files, and pipes (8 min)

Covered topics: working with multiple files using wildmasks, standard output redirection to a file, constructing complex commands with Unix pipes.

Aliases

Aliases are one-line shortcuts/abbreviation to avoid typing a longer command, e.g.

$ alias ls='ls -aFh'
$ alias pwd='pwd -P'
$ alias hi='history'
$ alias top='top -o cpu -s 10 -stats "pid,command,cpu,mem,threads,state,user"'
$ alias cedar='ssh -Y cedar.computecanada.ca'
$ alias weather='curl wttr.in/vancouver'
$ alias cal='gcal --starting-day=1'  # starts on Monday

Now, instead of typing ssh -Y cedar.computecanada.ca, you can simply type cedar. To see all your defined aliases, type alias. To remove, e.g. the alias cedar, type unalias cedar.

You may want to put all your alias definitions into the file ~/.bashrc which is run every time you start a new local or remote shell.