Every day, one of the first things I do on my computer is run update/upgrade. That process generally consists of three commands, which are:
- sudo apt-get update
- sudo apt-get upgrade -y
- sudo snap refresh
That’s not a lot to type. The only problem is that I have to wait for the previous command to stop before I can type the next one. Or, I can combine them into one long command like this:
sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh
That combination means I don’t have to wait for one command to complete before typing the next.
Also: How to Choose the Right Linux Desktop Distribution for You
Still, it’s a tall order to type every morning.
Luckily, this is Linux, so there’s always a way to make things easier – and in this case, it’s via aliases.
Simply put, an alias allows you to configure a word to serve as an alias for a command. Therefore, instead of typing:
sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh
I just have to type:
I was immediately asked for my sudo password and all three commands would run (one after the other) to take care of the update/upgrade/refresh process for me.
Too: 8 Things You Can Do With Linux That You Can’t With MacOS or Windows
Let me tell you how. It’s quite simple and can make your Linux-using life a lot more efficient.
How to create your first Linux alias
what you’ll need: The only thing you will need for this process is a running instance of Linux. It doesn’t matter which distribution you use as aliases are available for all of them, from the user-friendly Ubuntu to the highly complex Gentoo. I’ll be demonstrating on my current Linux distribution, Ubuntu Budgie.
First you need to log in to your Linux desktop or server and open a terminal window.
The file that contains the alias is called .bashrc. The .bashrc file is a script that contains several commands and environment settings that are executed when a user logs in to their Linux account. Within that file, there is a section which contains several pre-defined aliases (eg will put For ls -alf Permission).
Too: best linux laptop for everyone
We are going to create an alias for the upgrade process mentioned above. Keep in mind that the distribution you use will dictate the command you run (for example, dnf in place of apt for Fedora Linux).
Open the .bashrc file with the command:
Below, we’ll add our alias, which looks like this:
alias update="sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh"
The breakdown is simple:
The word alias informs bash that what comes after it is an alias. SHORTCUT is the word you want to use as a shortcut for the command that comes up for the alias. COMMAND is the actual command you want to use for the alias wrapped in single quotes.
Save and close the file.
nickname test
Do not close the current Terminal window. Instead, open another terminal (or a new tab in the current window) and type the shortcut used for the alias (in this case, Updates, The update command should run. If it does, congratulations, you’ve created your first Linux alias.
Too: The most important reason why you should use Linux at home
Remember, though, that the command you run for the alias will be different if you’re not using an Ubuntu-based distribution. And if your distribution doesn’t use snap packages, you’ll want to either remove the snap bit or replace it with the flatpak refresh command.











