A real help for Linux users with bad memories: Aliaser — take control of your aliases on Linux

 

Important
This is an edited version of a post that originally appeared on a blog called The Michigan Telephone Blog, which was written by a friend before he decided to stop blogging. It is reposted with his permission. Comments dated before the year 2013 were originally posted to his blog.
Tux, the Linux penguin
Image via Wikipedia

Here’s a program that may be useful for those of you who, like me, sometimes find ourselves at a Linux command prompt trying to recall the syntax of a command we use frequently (because, you know, it would never have occurred to the designers of Linux to actually implement commands with names that have a clear meaning in plain English):

Alias are a great tool to help increment your productivity on the terminal with bash (or any shell program you’re using), but usually we are too lazy to think at what are the most common, or long commands that we use frequently and prepare an alias for them.

And so someone has done a small piece of software to do this job: aliaser

Aliaser helps you identify frequently typed commands and creates bash aliases for them. Aliaser analyses your bash history and helps you identify commands that you use frequently.

Full article (with installation instructions) here.

One thing they forgot to mention is that once you’ve added an alias, it won’t actually be available for use until you log out and then log back in.  Also, you can delete the aliaser file and temporary directory from your /tmp directory once installation is complete.  If you ever want to uninstall aliaser, just remove the three lines added to your .bashrc file, remove the ~/.aliaser directory, and remove the /usr/bin/aliaser file.

One way I find this useful is to make commands I can’t remember into ones that that I can remember.  For example, I did this:

aliaser add processes “ps awx”

The Linux purists are probably rushing to comment that I just turned a six character command into a nine character one.  Yes, BUT, I can actually remember the word “processes”, whereas I cannot remember the options I need to use after “ps” to get the output I want. The designers of Linux seem to not realize that some of us users have really bad memories.  Another use for this is turning arcane Linux commands into the equivalent Windows commands that you’re familiar with.  You could do this:

aliaser add dir “ls -al”

So that when you type “dir”, you get a directory listing similar to what you are used to.

If you can’t even remember the aliases you’ve created (yeah, my memory really is that bad some days), just use aliaser show to see all the aliases you’ve added.

5 thoughts on “A real help for Linux users with bad memories: Aliaser — take control of your aliases on Linux

  1. Generally, aliases are placed into the $HOME/.bashrc file. After a change to that file, the command “source ~/.bashrc” loads the updates without requiring a log out/in.

    Also, investigate shell functions. They are mini-scripts loaded into the shell each time it is started. Functions allow multi-line “custom command.”

    1. Eric, that falls into the category of “not enough information to be really useful” for most people coming from a Windows background (links would have helped), but thanks for commenting anyway. I totally get it that Aliaser is not a program that a typical Linux purist would ever touch with a ten-foot pole, but maybe that’s why someone like me totally finds it useful. I don’t have the photographic memory required to be a true Linux geek, and I really want to spend as little time as possible at the Linux command prompt. So if I can’t get a GUI to perform a task, at the very least I’ll take something that makes doing things from the command prompt a whole lot easier, and that lessens the requirement to remember Linux commands that for the most part make no sense whatsoever and are not at all mnemonic.

  2. The linux commands carry over from unix, and all the commonly used commands are two characters because while “process” would be great as a command, the first UNIX machine ran in something like several kilobytes of ram. Brevity was key when doing multiuser computing in a few k of ram.

    That being said, as a purist I’ll point out that your command is actually longer than it needs to be to set this up, too. You can merely edit your .bashrc file to contain the lines:
    alias processes=”ps aux”
    alias dir=”ls -al”
    and then copy and paste those lines back into your console and you won’t have to reboot for them to take effect, and won’t have to use and install a program to manage them.

    These commands are actually shorter than aliaser add and aliaser delete

  3. (Back in my early solaris days, I had tcsh set up to take all DOS commands and turn them into unix equivalents. The machine and its data are out of reach to me, or I’d dig it up and send you a comprehensive list.)

  4. NOTICE: All comments above this one were imported from the original Michigan Telephone Blog and may or may not be relevant to the edited article above.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

Featured Article:

Recent Posts

Recent Comments

Archives

Categories

Meta

GiottoPress by Enrique Chavez

%d bloggers like this: