X
Collapse
-
How To Use alias Command in Linux
In Linux, commands help you achieve tasks like troubleshooting network issues, executing scripts, organizing system structure, and more. Moreover, some situations require you to run lengthy commands repeatedly, and typing them consumes much of your time. In this case, the alias command is the savior, creating shortcuts for long commands or a sequence of commands. It also improves productivity and reduces errors.
However, many users and even Linux experts have yet to learn how to use the alias command correctly. So, this short tutorial will quickly explain how to use the alias command in Linux without any hassles.
The alias Command with Examples
The alias command is simple, and you can use it as:
alias alias_name='command'
Please replace the ‘alias_name’ and ‘command’ with the name of the alias and the target command, respectively. In simple words, alias means the shortcut command you want to create. For instance, you can create the following alias if you frequently use the ‘sudo apt update && upgrade’ command to update the system:
alias update='sudo apt update && upgrade'
Now, whenever you type and run ‘update’ in the terminal, the system will automatically start updating:
The above aliases last only for the current terminal session. However, if you want to make a persisting alias, add it to your shell’s configuration file. Typically, for Bash, it is the ‘.bashrc’ file. Let’s retake the above example to convert ‘update’ to a permanent alias. First, you have to open the configuration file with a text editor:
nano ~/.bashrc
After that, add the aliases in the following manner:
alias update='sudo apt update && upgrade'
Finally, save the file and run the ‘source ~/.bashrc’ command to apply the changes.
A Quick Wrap-up
The alias command in Linux empowers a user to customize the command line experience and enhance productivity. By creating personalized shortcuts, you can easily streamline your workflow and navigate your system. Here, we discussed the method to create temporary and permanent aliases. Furthermore, remember all the mentioned tips to maintain clarity and efficiency.
More...Tags: None
Posting comments is disabled.
Categories
Collapse
Article Tags
Collapse
There are no tags yet.
Latest Articles
Collapse
-
by KasimbaArch Linux hasn't had a license for any package sources (such as PKGBUILD files) in the past, which is potentially problematic. Providing a license will preempt that uncertainty.
In RFC 40 we agreed to change all package sources to be licensed under the very liberal 0BSD license. This change will not limit what you can do with package sources. Check out the RFC for more on the rationale and prior discussion.
Before we make this change, we will provide contributors with...-
Channel: Articles
11-19-2024, 09:21 AM -
-
by Kasimba
by George Whittaker
Introduction
In the world of cybersecurity and software development, binary analysis holds a unique place. It is the art of examining compiled programs to understand their functionality, identify vulnerabilities, or debug issues—without access to the original source code. For Linux, which dominates servers, embedded systems, and even personal computing, the skill of binary analysis is...-
Channel: Articles
11-18-2024, 07:10 PM -
-
by KasimbaDebian and Ubuntu are two popular Linux distributions. In this deep dive we will guide you on the key differences between them from perspective of both corporate enterprise and personal productivity or pleasure usage. After reading this blog post you should be in a better position to decide to select Ubuntu or Debian.
Stewardship, Licensing, Community and Cost
Where as Debian is 100% fully committed to free software as defined by the Debian Free Software Guidelines, Ubuntu is created...-
Channel: Articles
11-17-2024, 08:30 PM -
-
by Kasimba
by George Whittaker
Introduction
In the digital age, data loss is a critical concern, and effective backup and recovery systems are vital for any Debian system administrator or user. Debian, known for its stability and suitability in enterprise, server, and personal computing environments, offers a multitude of tools for creating robust backup and recovery solutions. This guide will explore these solutions,...-
Channel: Articles
11-13-2024, 05:30 PM -
-
by Kasimba
by George Whittaker
Introduction
Debian is one of the most trusted and stable Linux distributions, making it a top choice among developers and system administrators. Setting up a powerful development environment on Debian involves installing the right tools, compilers, libraries, and Integrated Development Environments (IDEs) that can support various programming languages and workflows. This guide provides...-
Channel: Articles
11-07-2024, 11:22 PM -
-
by Kasimba
by George Whittaker
In today’s digital world, data is more than just information; it’s a part of our lives. From photos and documents to sensitive personal information, our data represents our memories, work, and interests. While cloud storage services are widely available, they often come with privacy concerns, subscription fees, and limitations on customization. This is where building a personal cloud on Ubuntu comes...-
Channel: Articles
11-07-2024, 04:30 PM -