Vol. I · No. 46The command line sectionSat, 10 Oct 2026
Linux · system information

alias

a shortcut for a command

alias gives a command a nickname. Type the short name and the shell replaces it with the full command. An alias lasts only for the current shell unless it is written into ~/.bashrc.

If you type it ten times a day, give it a two-letter name.

Define
alias ll='ls -la'
no spaces around the =
List
alias
with no arguments
Remove
unalias ll
for this shell
Keep it
~/.bashrc
read at every new shell

At the terminal

Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.

user@netflow — bashbash
$ alias
1alias grep='grep --color=auto'
alias ll='ls -alF'
2$ alias gs='git status'
3$ type ll
ll is aliased to `ls -alF'
4$ echo "alias gs='git status'" >> ~/.bashrc
Illustrative session · names, sizes and dates are examples, and every address is from a documentation or private range
Reading the output

What the numbered lines are telling you

1
Aliases you already have

Most distributions define a few. This is why grep shows colour and ll works without you having set anything up.

2
Defining one

From now on, in this shell, gs runs git status. Quote the command so the spaces are kept together.

3
type shows what a name means

It reports that ll is an alias and what it expands to.

4
Making it permanent

Appending the line to ~/.bashrc defines the alias in every new shell. Run "source ~/.bashrc" to load it now.

Switches

A switch changes how the command behaves. These are the ones used day to day; man alias lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.

-p
Print all aliases in a form that can be reused as input.

Variations worth knowing

The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.

alias rm='rm -i'

Makes rm ask before each removal.

\ls

A leading backslash runs the real command, ignoring any alias.

unalias -a

Removes every alias from the current shell.

alias ports='ss -tulpn'

A memorable name for a command with awkward switches.

In cybersecurity

An alias means the command you type may not be the command that runs.

A hijacked alias

Someone with write access to your .bashrc can alias sudo to a script that records your password and then runs the real sudo. Check with "type sudo".

Aliases are not a safety net

alias rm='rm -i' is not there in scripts, under sudo, or on the next machine. Do not let it teach you to type rm carelessly.

Protect your dot files

~/.bashrc and ~/.profile run at every login. They should be writable only by you.

Filed under

System information

Read alongside