How to Update Your Linux Machine with Just One Command

Ever find yourself typing out sudo apt update; sudo apt upgrade -y and wondering why it feels like such a chore, even if you can type it in a couple of seconds? What if I told you that you could reduce that entire command to just typing update? Yes, just one simple word, and you’re done! Here’s how you can save those precious seconds every time you update your system.

I have done this on my Linux Mint, your command might just be different based on the distro but the process will be the same. Also you can use nala, as it is better version of the apt with more features.

Simplify Your Workflow with an Alias

Setting this up is super easy. Just follow these steps to create an alias that will do all the heavy lifting for you:

  1. Open Your Shell Configuration File:

    • If you’re using bash, open the .bashrc file:

        nano ~/.bashrc
      
    • If you’re using zsh, open the .zshrc file:

        nano ~/.zshrc
      
  2. Add the Alias:

    • Scroll to the end of the file and add this line:

        alias update='sudo apt update; sudo apt upgrade -y'
      

This alias replaces the need to type out the full command every time you want to update your machine.

  1. Save the File:

    • After adding the alias, save the file by pressing Ctrl + s and then pressing Ctrl + x to exit.
  2. Apply the Changes:

    • To make the alias active, run:

        source ~/.bashrc   # For bash
        source ~/.zshrc    # For zsh
      

And that’s it! Now, whenever you type update in your terminal, it will automatically execute sudo apt update; sudo apt upgrade -y, doing all the hard work for you.

Why Bother?

By adding this alias, you’re not just saving a few keystrokes—you’re streamlining your workflow. It’s a small change, but it can make a big difference if you find yourself running updates frequently. Plus, you can use this trick to create aliases for any other commands you use often.

Give it a try, and enjoy your newfound efficiency!

0
Subscribe to my newsletter

Read articles from Md Sakib Sadman Badhon directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Md Sakib Sadman Badhon
Md Sakib Sadman Badhon

Hello, I am Badhon. I tend to forget things easily which is why I opened this blog.