Fundamentals 5 min read

Master Linux Aliases: Simplify Commands and Boost Productivity

This guide explains when to use Linux alias commands, how to create temporary and permanent aliases, list and verify them, remove unwanted ones, and provides practical examples for simplifying commands, changing behavior, and accessing shortcuts, helping users streamline their shell workflow.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Aliases: Simplify Commands and Boost Productivity

When to use alias

Simplify long or complex commands

Remember commands with complicated names

Save time for frequently used commands

Creating an alias

Example: alias la='ls -al'. After defining the alias, you can run la to list all files, including hidden ones.

[root@server1 ~]# alias la='ls -al'
[root@server1 ~]# la
total 68
dr-xr-x---. 3 root root 216 May 25 13:13 .
... (output truncated for brevity)

Persisting aliases

To make an alias permanent, append its definition to ~/.bashrc: echo "alias la='ls -al'" >> ~/.bashrc Reload the file or start a new shell session to apply the change.

Listing and checking aliases

Use alias to list all defined aliases: alias Use which la to verify that la is an alias:

[root@server1 ~]# which la
alias la='ls -al'
/usr/bin/ls

Removing an alias

Temporarily disable an alias with unalias: [root@server1 ~]# unalias la To remove it permanently, delete the corresponding line from ~/.bashrc.

Practical alias examples

alias c='clear'
alias ll='ls -al'
alias new='ls -1tr | tail -5'
alias ping='ping -c 4'
alias untar='tar -xvf'
alias rec='history | grep'
alias ?='apropos'
alias myip='hostname -I'

Using alias to search related commands

Define a shortcut for apropos: alias ?="apropos" Then search for commands related to "compress":

[root@server1 ~]# ? compress

Conclusion

Aliases are a frequently used feature in Linux that can make command‑line work smoother. This article shows how to create, persist, list, verify, and delete aliases, and offers useful examples for shortening commands, modifying behavior, and accessing shortcuts.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxcommand-lineAlias
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.