How to Create Command Shortcuts with the alias Command
An alias is a short name for a longer command. alias ll='ls -l' lets you type ll instead of the full command. Aliases live for the session unless you add them to ~/.bashrc, where they load with every new terminal.
Create an alias for the session
Type alias, the name, an equals sign and the command in quotes. The alias is active immediately in the current terminal.
Use it right away
Now type ll anywhere and bash expands it to ls -lh. Common handy aliases include ll, la (ls -A) and grep with color.
Make aliases permanent
Session aliases vanish when the terminal closes. Add the alias line to ~/.bashrc, which bash reads at every interactive start. Then run source ~/.bashrc to load it now.
List and remove aliases
alias with no arguments lists everything defined. Remove one with unalias, and see what an alias expands to by typing its name.
Aliases vs functions
Aliases are simple text replacements. For commands that take arguments in the middle, or multi-line logic, a bash function is more powerful. See bash scripting and the alias reference.
Keep learning
Related guides: How to Reuse Commands with the bash history Feature · Linux Environment Variables: How to Set and Use Them · How to Write Your First Bash Script. Read all tutorials on the Learn Linux blog.