Sometimes a command is either too long to always be typing out or you simply cannot always remember it. Or maybe you have a collection of commands that you frequently run, and constantly typing them isn’t the best use of your time. When that’s the case, what do you do? You create aliases.

SEE: The best programming languages to learn–and the worst (TechRepublic Premium)

In Linux, an alias is a feature of bash that makes it possible for you to use shorthand for commands. Say, for instance, you have a bunch of servers you frequently SSH into and out of during the day. You could either configure them in the SSH config file or create an even faster alias. So instead of typing the command ssh jack@ to gain remote access to your web1 server, you could just type web1. How do you do this? It’s all in the .bash_aliases file in your home directory.

Open that file with the command nano ~/.bash_aliases. In that file, you can add as many aliases as you like in the form of alias NICKNAME=’COMMAND’ (Where NICKNAME is the shorthand name for the command and COMMAND is the actual command to run).

SEE: C++ programming language: How it became the foundation for everything, and what’s next (free PDF) (TechRepublic)

So, let’s stick with our SSH example.

  1. For that, you’d add alias web1=’ssh jack@′.
  2. Save and close the file.

Now, here’s the trick: You need to close that terminal window before the new alias will take effect. Once you start a new terminal, you can simply type web1 to run the command.

And that’s all there is to creating an alias for a command on Linux. Get really creative with this, and your command-line work in Linux will become much more efficient.

Image: Jack Wallen