Build a Better Process

Linux alias Command Summary with Examples

Linux alias allows you to customize a commmand.
  1. Purpose - Learn what alias is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with alias.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 23, 2021
In this tutorial on Linux alias, 12 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / alias-command.html

An ad-free and cookie-free website.

Examples of the Linux alias Command


Learn to customize commands at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux alias Command Summary with Examples (3:38)

Video Script

The Command and Why You Need It

Our twelth word, or command to memorize is alias from the category System.

alias allows you to customize a command. Recall from our last video that alias is a command type, and here we'll learn more.

Common Linux alias Options
-options description
-p Print aliases in a reusable form

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The alias command has 1 option, and arguments you provide will either list, or create the alias.

The -p option will print aliases in a reusable form in case you want to create a file for a bunch of aliases.

So why is alias an important command? Well, alias will help you customize your system, and save you keystrokes. And now you know how to do that.


Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go, type alias without options or arguments.

$ alias alias ls='ls --color=auto' $ ls video11.txt video5.txt

And look, one for the command from video 7, ls. To interpret, when ls is run, Linux runs text inside the quotes, and this sets the output colors.

Next, let's say we prefer to view ls in one column instead of several, but since this requires three extra keystrokes, space-dash-1, we could edit this alias, by adding the option -1. Saving, viewing and giving it a go.

$ alias ls='ls -1 --color=auto' $ ls video11.txt video5.txt

Now, we could create a new alias that also reminds us of the current directory. Pick a new name, lsd, and make sure it isn't taken by using the type command.

$ alias lsd -bash: type: lsd: not found

Good. It's free. Up-arrow to recycle, add a semi-colon, the pwd command, enter, and test lsd.

$ alias lsd='ls -1 --color=auto; pwd' $ lsd video11.txt video5.txt /home/paul

A Final Tip

Okay now you know how to use alias. And you know the syntax for commands, options and arguments.

One last tip about the alias command. Aliases expire each session unless saved in user configuration files, so I'll introduce users next.

Okay, thanks for visiting today. I hope this was a fun introduction to the alias command.

Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:

What's Next?

Don't miss the next chance to expand your mind. Subscribe and follow our no-spam email list.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / alias-command.html

linux alias command
unix alias
bash alias
set alias
create alias linux
shell alias
rename alias
terminal alias
linux alias bashrc
make alias
linux alias examples
linux show aliases
linux alias tutorial
modify commands with alias
customize commands with alias
list aliases

A newly-updated free resource. Connect and refer a friend today.