alias
Create an alias for a command
Overview
Allows users to create, display, or remove command aliases. Aliases are shortcuts or custom names for longer or frequently used commands, improving efficiency and reducing typing.
Syntax
alias [NAME[=VALUE] ...]Common Options
aliasWithout arguments, displays all currently defined aliases in a reusable format.
alias NAMEDisplays the definition of the alias specified by NAME.
alias NAME='COMMAND_STRING'Defines an alias named NAME for COMMAND_STRING. Quotes are needed if COMMAND_STRING contains spaces or special characters.
unalias NAMERemoves the alias specified by NAME. (Note: `unalias` is a separate but related command).
PersistenceTo make aliases permanent, add their definitions to your shell startup file (e.g., `~/.bashrc` for bash, `~/.zshrc` for zsh) and then source the file or open a new terminal.
Examples
Shows all currently defined aliases.
Creates an alias `ll` that executes `ls -alF` (detailed list including hidden files).
Creates an `update` alias for system updates (Debian/Ubuntu).
Creates `..` as a shortcut for `cd ..` (go to parent directory).
Creates `myip` to display your public IP address using `curl`.
Creates an alias for `rm` that prompts before every removal (interactive mode).
Removes the alias named `myip`.
alias ll='ls -alF'
source ~/.bashrc