O'Reilly logo

Linux Shell Scripting Cookbook by Sarath Lakshman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Visiting aliases

An alias is basically a shortcut that takes the place of typing a long command sequence.

Getting ready

Aliases can be implemented in multiple ways, either by using functions or by using the alias command.

How to do it...

An alias can be implemented as follows:

$ alias new_command='command sequence'

Giving a shortcut to the install command, apt-get install, can be done as follows:

$ alias install='sudo apt-get install'

Therefore, we can use install pidgin instead of sudo apt-get install pidgin.

The alias command is temporary; aliasing exists until we close the current terminal only. In order to keep these shortcuts permanent, add this statement to the ~/.bashrc file. Commands in ~/.bashrc are always executed when a new shell process ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required