An alias is a short name for a command line that you type often:
text
learner@tidepool:~$ alias ll='ls -l'
learner@tidepool:~$ ll ~/shop
-rw-r--r-- 1 learner learner 21 Oct 11 09:15 prices.txtll ~/shopyou type
Shellchanges the first word
ls -l ~/shopruns
Put the value in single quotes. It has a space, so it must be one argument.
Work with aliases
| Line | Does |
|---|---|
alias NAME='LINE' | Makes an alias |
alias | Lists all aliases |
type NAME | Writes NAME is aliased to ... for an alias |
unalias NAME | Removes an alias |
Your shell may already have some aliases. Run alias to see them.
Aliases exist only in this shell
An alias is like a shell variable: it exists only in the shell where you made it. A new terminal does not have it. The next lesson shows how to keep it.