Unix Tip – Shortening The Abbreviations

Even for us fast typists, our hands start to complain after a few hours or more of banging on our keyboards. Sometimes the best thing to do is what is really the only apparent chance of survival—shorten all these abbreviations even more.Please note, this guide is intended to be used by Linux and Unix users. Yes, Mac users… if you can believe it, Mac is all Unix on the inside.

I recommend viewing the Feedback section of this article; it contains a different and probably better method of carrying this out.

So, let’s get started! It won’t take too long to abbreviate some of the most commonly-used commands. All we have to do is make symbolic links for all these commands, most of which live in our executable directory of /usr/bin. We’re going to take advantage of the fact that most programs never use one-letter commands. So, open up a new terminal, and let’s soothe those tired hands!

Type a quick su command to prevent the need of constantly temporarily running a super-user command. You’ll probably be asked for the root password.

Change to the executable directory, /usr/bin, by typing cd /usr/bin.

One of the most popular commands in the Linux terminal is the sudo command, so let’s get that one shortened first. Note that this is already an abbreviation for super user—but what the heck, sudo is still three letters longer than we need it to be.

To prevent any crashing, corruption, or explosion of your system, I strongly recommend not to just rename the file! That would probably cause major problems in the future. Instead, we’re going to use the symbolic link method which I mentioned earlier. Type:

ln -s sudo s

This is creating a link, noting that it is symbolic (with the -s switch) and giving our input and output files.

Now, whenever you would like to execute a file as a super user, you only need to type two keystrokes instead of five (counting the space between commands). For example:

s apt-get autoremove

Much easier, right? But not easy enough! Let’s keep going! Exemplified in the command above, apt-get is another popular—but unfortunately long—command. We’re going to fix that right now, and shorten the command by 6 characters. Simply type this:

ln -s apt-get g

Now our earlier example is abbreviated to this short line:

s g autoremove

Unfortunately, I will not go into abbreviating parameters like autoremove, as that is much more difficult and probably too scary for the new Linux/Unix/Mac terminal user.

However, there are still a plethora of commonly-used commands that are just waiting to be shortened. I will publish a list of recommended abbreviations later on.


Scary-reasoner made a good point about how creating symbolic links in /usr/bin is not the best idea for your system. Instead, you can create shell aliases, which were made for this very reason (and others). Here’s a quick example of creating an alias instead of a symlink for the sudo command:

alias s='sudo'

That will do it for you. The sudo command now has an alias of s. Let’s do one more, to ensure understanding.. I’ll show the apt-get shortening command:

alias g='apt-get'

If you would like any more help on it, Keith Winston wrote a great article about shell aliases. (You can get a cached version of the article from Google, in case the original link becomes broken).

Did you find this article useful? Please leave a comment to let me know. Don’t worry, you don’t need to register for a simple comment.

6 Responses to “Unix Tip – Shortening The Abbreviations”

  1. 1 scaryreasoner December 3, 2007 at 8:22 pm

    Using symlinks in /usr/bin for this is probably not a good idea.

    Use shell aliases, the usage pattern you are describing, shortcut abbreviations, is the reason shell aliases were invented. If you want them just for your (or root’s — bad idea) put them in the user’s ~/.bashrc file. If you want them global, in /etc/bashrc

    Or, put the symlinks (or your custom scripts) in ~/bin, and put that in your path before /usr/bin.

    Renaming files in /usr/bin is bad, as you note, but would probably break things much sooner than the nebulous “in future.” Try next reboot, or sooner, when all those scripts in /etc/init.d, or in your crontab, try to run, or when you try to run something in /usr/bin that turns out to be a shell script (as half the stuff in /usr/bin seems to be these days) which relies on the traditional names.

  2. 2 scaryreasoner December 3, 2007 at 8:27 pm

    Just thought of one other thing. There are exceptional instances in which you may want to override a command with a symlink, sort of the way you describe.

    For example, ccache ( ccache.samba.org ) is a caching front end to the C compiler, gcc. The quickest, easiest way to invoke it is make /usr/local/bin/gcc a symlink to /usr/local/bin/ccache.

    Then all your makefiles and such automatically use ccache, system-wide, which is typically what you want.

    That’s the kind of situation where using symlinks makes sense.

  3. 4 fused quartz August 14, 2014 at 9:50 pm

    The hydrolysis of hippurate liberates two major end products,
    glycine and benzoic acid. (It never moves
    farther away than 3 AU from the sun. Their tactics were to operate primarily on the surface using their regular engines, then submerging to attack, using battery power.

  4. 5 earleonqjfootg.wordpress.com August 16, 2014 at 2:51 pm

    Feng Shui tea (9): This tea is a combination of
    traditional oriental herbs designed to help reduce the body’s susceptibility to electromagnetic
    stresses. It features various round faceted and oval fancy cut stones in your
    choice of rose quartz or smoky quartz. Chrysoberyl This gemstone is arguably the most popular
    gemstone for its cats eye inclusions.

  1. 1 Park Hotel Bydgoszcz Wesela Trackback on June 7, 2014 at 7:28 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: