To make aliases permanent, you need to add them to your shell's configuration file. Here’s how you can do it for different shells:
For Bash
- Open your terminal.
- Edit the
.bashrcfile in your home directory:nano ~/.bashrc - Add your alias at the end of the file. For example:
alias ll='ls -la' - Save the file and exit the editor (in nano, you can do this by pressing
CTRL + X, thenY, andEnter). - To apply the changes, run:
source ~/.bashrc
For Zsh
- Open your terminal.
- Edit the
.zshrcfile in your home directory:nano ~/.zshrc - Add your alias at the end of the file. For example:
alias ll='ls -la' - Save the file and exit the editor.
- To apply the changes, run:
source ~/.zshrc
After following these steps, your aliases will be available in every new terminal session.
