Command aliases in Linux are shortcuts that allow you to create a custom name for a command or a series of commands. This can simplify your command-line usage and save time.
Creating an Alias
You can create an alias using the alias command. The syntax is:
alias name='command'
For example:
alias ll='ls -la'
This creates an alias ll that executes ls -la when typed.
Viewing Aliases
To view all currently defined aliases, simply type:
alias
Removing an Alias
To remove an alias, use the unalias command:
unalias name
For example:
unalias ll
Persistence
Aliases defined in the terminal session will be lost when you close the terminal. To make them permanent, add the alias command to your shell's configuration file (e.g., ~/.bashrc for Bash or ~/.zshrc for Zsh).
If you have more questions or need examples, feel free to ask!
