whatis alias
Alias
A shell shortcut that replaces a short name with a longer command, such as alias ll='ls -lah'.
What Is an Alias in Linux?
Aliases are expanded by the shell before the command runs. They are handy for flags you always use, but they only work in interactive shells and only for the first word of a command.
Define them in ~/.bashrc or ~/.zshrc to make them permanent. For anything that needs arguments in the middle or logic, write a shell function instead. \ls or command ls bypasses an alias.
Example
alias ll='ls -lah'
alias | grep ll Learn more about Alias
- bashrc vs bash_profile vs profile: Which File to Put Things In Login shells read one set of files, interactive shells read another, and non-interactive shells read almost nothing. That is why your PATH works in a terminal and not in cron, and why your alias vanishes over ssh.
- Managing Dotfiles: Stow, chezmoi and the Bare Git Repo Three approaches to keeping your config in version control and getting it onto a new machine. Which handles per-host differences, which handles secrets, and why copying files around by hand always ends the same way.