Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.


How to create a simple Linux alias to run all of your upgrade commands with a single word

Aliases are a great way to make complicated or long Linux commands easier. Here's an example of how you can use aliases to update and upgrade your Linux operating system.
Written by Jack Wallen, Contributing Writer
Person using laptop
mapodile/Getty Images

Every day, one of the first things I do on my computer is run an update/upgrade. That process normally consists of three commands, which are:

  • sudo apt-get update
  • sudo apt-get upgrade -y
  • sudo snap refresh

That's not too much to type. The only problem is that I have to wait for the previous command to stop before I can type the next. 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

Even so, that's a long command to type every morning. 

Fortunately, 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 single word to serve as an alias for a command. So, instead of typing:

sudo apt-get update && sudo apt-get upgrade -y && sudo snap refresh

All I have to do is type:


I'm immediately prompted for my sudo password and all three commands will run (one after another), to take care of the update/upgrade/refresh process for me.

Also: 8 things you can do with Linux that you can't do with MacOS or Windows

Let me show you how. It's quite easy and can make your Linux-using life considerably more efficient.

How to create your first Linux alias

What you'll need: The only thing you'll need for this process is a running instance of Linux. It doesn't matter what distribution you use because aliases are available to all of them, from the user-friendly Ubuntu all the way to the fiercely complicated Gentoo. I'll demonstrate on my current go-to Linux distribution, Ubuntu Budgie.

1. Open a terminal window

The first thing to do is log in to your Linux desktop or server and open a terminal window.

2. Open the .bashrc file

The file that houses aliases is called .bashrc. The .bashrc file is a script that holds a number of commands and environmental settings that are executed when a user logs into their Linux account. Within that file, there's a section that includes a number of pre-defined aliases (such as ll for the ls -alF command). 

Also: The best Linux laptops for everyone

We're going to create an alias for the upgrade process I outlined 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:

nano ~/.bashrc

3. Edit .bashrc

Scroll down until you see the section that starts with # some more ls aliases. We're going to add our new alias below that section. 

Also: Ubuntu Cinnamon makes switching from Windows to Linux as painless as possible

First, add a comment, so you know what the alias is that we're creating. That comment could be something like this:

# update alias

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 follows is an alias. SHORTCUT is the word you want to use for the alias as a shortcut for the command that follows. COMMAND is the actual command you want to use for the alias, wrapped in single quotes.

Save and close the file.

Testing the alias

Don't close the current terminal window. Instead, open a second terminal (or a new tab in the current window) and type the shortcut we used for the alias (in this case, update). The update command should run. If it does, congratulations, you've just created your first Linux alias.

Also: The most important reason you should be using Linux at home

Remember, however, that if you're not using an Ubuntu-based distribution, the command you run for the alias will be different. 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.

Editorial standards