/ factorpad.com / tech / linux-essentials / alias-command.html
An ad-free and cookie-free website.
Beginner
Learn to customize commands at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux alias Command Summary with Examples (3:38)
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.
-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.
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.
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.
Good. It's free. Up-arrow to recycle, add a semi-colon, the pwd
command, enter, and test lsd
.
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.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Don't miss the next chance to expand your mind. Subscribe and follow our no-spam email list.
type
command,
hit Back.whoami
command, click Next./ factorpad.com / tech / linux-essentials / alias-command.html
A newly-updated free resource. Connect and refer a friend today.