You can also make aliases for existing commands. If you want ls to show colors by default, do:

alias ls='ls --color=yes'

These aliases can be put in your login script (.bash_profile or .profile depending on what shell you are using).

Alias with variables

You can not make aliases with variables. But you can make functions, having a function in your .profile/.bashrc will work just like an alias. To use ssh to copy files to a location on a server you can use

sendpic () { scp "$@" mina@foo.bar.ca:/www/misc/Pictures/; }

Another way for aliases with variables

If you dont like to use a function, if you need variables, try the following to change to the last working directory:

alias cdo="cd \"\$OLDPWD\""

Note: it is important, that there are ONLY double quotes in the expression above, no single quotes like in the other examples!

Creating aliases on shell startup

You can have your aliases created anytime you open an instance of a shell. If you are using bash, edit your ~/.bashrc file and add one alias per line. Once you save and close the file, run this to load your new aliases immediately:

source ~/.bashrc

Otherwise, the new aliases will load whenever you open a new instance of the shell.

Another place to put your aliases if you want them to be system-wide for all users is in /etc/bashrc. To load those aliases, add this line to ~/.bashrc