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.
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/lsRemoving 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 ~]# ? compressConclusion
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.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
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.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
