GNU Bash Logo

// Tutorials //

How to create Alias command in Linux

by Dillon - Updated -

Alias commands in Linux are a great way to speed up your workflow. In this post, I will show you how to create Alias command in Linux.

What is an Alias command?

An Alias command is a shortcut to another command. Alias commands are useful when you need to write a long command multiple times. To save time, you can create a short Alias command to remove the need of writing the same lengthy command over and over again.

Examples of existing Alias commands on Linux

Out of the box, Linux comes with pre-created Alias commands. You likely use these commands regularly without knowing it.

From the terminal, type alias and hit ENTER. This will print all the Alias commands on your system.

Default Alias Commands in Linux

As you can see, there are already a number of Alias commands on your system.

Create an Alias command on Linux

Open a new terminal. You will already be in the user’s home directory.

Form the user’s home directory, open the .bashrc file in an editor.

At the bottom of the file, add the following:

alias docs='cd Documents'

Save and exit the file.

The new Alias command will change our directory to the user’s Documents directory when executing the alias ‘docs‘.

How to use Alias commands in Linux

Now we have created our Alias command, close the terminal and re-open a new terminal window.

To execute the new Alias command, simply type ‘docs

Create new Alias command in Linux

Conclusion

Alias commands in Linux are a great way to speed up your workflow when need to execute repetitive commands.

I use Alias commands daily to move around the filesystem when configuring new sites.

Related Posts

Dillon Smart

👋 Hey, I'm Dillon!

I'm a Full Stack developer from the U.K. I've been building websites and applications for 11 years! Along the way I've picked up a few things, and share them here on IKnowThatNow.com.

Feel free to reach out on Twitter!

0 Comment

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.