Create permanent bash aliases

Make short commands like ll or backup run your long ones in every new terminal.

LinuxbashaliasLow risk
Add alias ll='ls -la' to ~/.bash_aliases, then run source ~/.bash_aliases to use it immediately.

01Command

Command
$ echo "alias ll='ls -la'" >> ~/.bash_aliases && source ~/.bash_aliases && ll

02What it does

Aliases typed in a terminal die when it closes; storing them in ~/.bash_aliases (loaded by ~/.bashrc on Ubuntu and most distros) makes them permanent. The syntax is alias name='command', quotes included. After editing, source the file or open a new terminal — then test with the alias alone or type alias to list all of them.

03Risk

RiskLow risk
!Warning: Bash-only: if your login shell is zsh or fish, aliases go in ~/.zshrc instead. Aliases don't accept arguments — for those write a small function or script. Also don't shadow existing command names by accident (alias cp='cp -i' is fine; alias rm='rm -rf' is not).

04Undo

Undo
$ Remove the alias line from ~/.bash_aliases (e.g. sed -i '/alias ll=/d' ~/.bash_aliases)

05Sources

  • Bash — Arch Wiki
    Arch Linux · community · 2026-09-17
    Evidence: Explains aliases in ~/.bashrc and the ~/.bash_aliases convention: aliases defined there persist across sessions because the file is sourced by the shell startup files.

Last verified: 2026-09-18 · Category: Developer