How to Create an Alias for a Long Command in Linux

Typing out long, complex commands in the Linux terminal repeatedly is tedious. Creating an alias allows you to assign a short, custom keyword to trigger the long command instantly.

How to Create an Alias

  1. Open your terminal.
  2. Open your bash profile by typing: nano ~/.bashrc
  3. Scroll to the bottom of the file and add your alias. For example: alias update='sudo apt update && sudo apt upgrade -y'
  4. Save the file (Ctrl+O, Enter, Ctrl+X) and reload your profile: source ~/.bashrc.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.