Welcome to rc-linux.com

A personal blog about Linux and FOSS in general

I created a program to help you manage your aliases

Edit : Since I wrote this article, I have created a new version of this program called “malias” which is way more elegantly developed !
Please, check the following link for more information :

I mostly talked about Linux as a desktop operating system so far. But, even if you do not have to know how to use it to adopt Linux nowadays, the terminal is one of the most important part of your Linux OS.

Just to make things clear, keep in mind that every tasks you’re doing on your computer (such as opening a software by clicking on its icon or updating an application through your software center) is, in fact, a visual translation of terminal commands. Everything is translated as command lines through your terminal in background.

Obviously, you’re allowed to use this terminal directly. It comes with every Linux distribution and will give you more flexibility, options, possibilities and a total control of your system.

I’m working with Linux Servers at my job. Those servers do not come with a desktop environment or any graphical interface by default (unlike Windows). All you have is a CLI (Command Line Interface).

Created with GIMP

The next articles will mostly focus on the terminal now.

I will not explain how to use the terminal in detail, there’s a lot of tutorials on the internet.

You can find a list of principal commands here, for instance.


One of the most useful things integrated into the terminal are “aliases” (in my opinion).

Aliases are basically a way to create your own personalised “translation” for any text you can type in your terminal, whether it is a command, a script or a path to a file/directory for instance (even though we would prefer to use environment variables for this last example).

To sum up, aliases are a way to tell your system terminal that “text a” = “text b”

Okay… But what’s the purpose ?

Aliases can have as many purposes as your imagination can think of, but I’ll give you some examples of how I use them personally :

– To get your terminal more ergonomic and intuitive :

Some commands are really intuitive, some are not…

For instance, if you want to install a program (let’s say Nginx) on your Debian/Ubuntu based Linux computer via your terminal, you’ll need to type : apt-get install nginx

On a Red Hat/Fedora based Linux computer, you’ll go with : yum install nginx

Even worse, on an Arch based Linux computer, you’ll go with : pacman -S nginx

Those commands, as efficient as they are, are not that much intuitive… Specially for a beginner.

Well, aliases can help you with that. For instance, you can create the following alias :

install = apt-get install

This way, I can just type “install nginx” to… install nginx ! Way more ergonomic and intuitive right ?

– To save some time :

We all know that IT guys are lazy right ?

The best example I can give you is updating your machine.

Indeed, on a Ubuntu based Linux distribution, you’ll type the following commands to fully upgrade your machine (I’m taking a heavy example on purpose) :

1 – sudo apt-get update –> Update your repository list to check if there’s available updates

2 – sudo apt-get upgrade –> Download and install available updates (if there are)

3 – sudo snap refresh –> Download and install updates for your snap software (if there are. Snap is an alternate way of installing software. If you don’t have any Snap software, you won’t need this.)

4 – sudo flatpak-update –> Download and install updates for your flatpak software (if there are. Flatpak is an alternate way of installing software. If you don’t have any Flatpak software, you won’t need this.)

As I said earlier, this one is purposely an heavy example, just to illustrate. Anyway, that’s a total of 4 commands to fully upgrade your machine.

Well, there’s a trick to put all those 4 commands into one, by using the “&&” signs (like so : command 1 && command 2 && command x). Those two signs can be translated as “and” (pretty obvious right ?).

Back, on topic. Using the “&&” signs, our “full upgrade” command will look like this :

sudo apt-get update && sudo apt-get upgrade && sudo snap refresh && sudo flatpak-update

It has been transformed into one command, but that’s still a pretty long command to remember and type right ?

That’s where aliases gets interesting.

Remember ? Aliases are a way to tell your system terminal that “text a” = “text b”.

So, to continue with our fully upgrade example, we can setup an alias this way :

fullupgrade = sudo apt-get update && sudo apt-get upgrade && sudo snap refresh && sudo flatpak-update

This way, the next time I want to fully upgrade my machine, I’ll just need to type “fullupgrade” in my terminal and it will translate it as “sudo apt-get update && sudo apt-get upgrade && sudo snap refresh && sudo flatpak-update” automatically !

This way, you can save yourself a ton of time ! Specially on long commands that you often run.

– To fit your habits :

I’ll give you two quick examples for this one.

I’ve always learned to work with the vi text editor in my terminal during my studies. Therefore, I’ve always typed the “vi” command to edit my files, like so : vi filename

A few years later, I discovered vim (an improved version of “vi”). As good as it is, it took me a long time to replace “vi” with “vim”, for the simple reason that I was too used to type the “vi” command.

You guessed it, I created the following alias : vi = vim

This way, I can still type “vi” like I’m used to and use “vim” at the same time !

Another example that I’m using everyday at work :

The “ls” command aim is to list directory contents. There’s a useful option with this command that allows you to have more information then the filenames (such has associated rights, date of creation, etc…).

You can use this option by typing “ls -l”.

As a lot of people are using this option, most of Linux distributions created an alias for this specific option by default, which is “ll” (ll = ls -l). And I got use to it very quickly ! “ll” is intuitive and way faster to type then “ls -l”.

But, back when I got hired at my current job, a co-worker showed me some additional interesting options to the ls command. So, my dear “ll”, became “ls -ltr”. And frankly, it was a pain for me to type “ls -ltr” and not “ll” as I was used to ! Unless, I can modify the alias like ll = ls -ltr ? 😉

– To secure potentially dangerous commands :

Keep in mind that humans often fail… Machines don’t !

If you often use commands that can have some serious repercussions on your system (or your data) in case of errors or mistypes (such as the “rm” command to delete some files or the “kill” command to shut a particular process), you’d better put them in aliases.

Let me give you some examples :

“This software creates some temporary files each time I open it and do not delete them after I’m done using it, even though they are not necessary any more… That takes space on my hard drive for nothing ! So I took the habit to delete them manually after each session with the following command : rm -f /var/software/tmp/*

And that works great ! Until I mistyped my command one day and deleted my entire /var folder…”

That would’ve not happened if you had setup an alias on that command.

“This software keeps running in background even when I quit it… Strange right ? Never mind, I took the habit to retrieve and copy/paste the associated process’s ID into a “kill” command.

And that works great ! Until I failed my copy/paste and accidentally killed my webserver’s process instead…”

That would’ve not happened if you had setup an alias for this.

Alright, that’s great ! But how can I setup my own aliases ?

And… This is the problematic point in my opinion.

Indeed, as useful as aliases are to me, I saw that not many people were using them.

Why is that ? People don’t even know about aliases or, at least, don’t know how to setup them. And, as a matter of fact, aliases are kind of tough to setup… Specially for a beginner.

To sum it up, you need to use the “alias” command like this : alias ll=’ls -ltr’ (it’s just a simple example)

But that will create your alias only for your current session, it will disappear after you logoff. To make it permanent, you need to add the above “alias“ command to your .bashrc file which is a hidden system file stored in your /home directory (it is a file that will automatically launch every command wrote in it each time you connect to your session).

After you added it to your .bashrc file, you need to “reload” your .bashrc file to apply your new alias with the “source command”. If you misspelled your alias command in your .bashrc file, it will gives you an error that will probably not be easy to understand for a beginner, so you’ll need to re-edit your .bashrc file and try to find why it is not working… And after that you’ll need to… And after that you’ll need to… And after that you’ll need to…

Well, it is in fact not that hard… If you want to know how to setup aliases correctly, you can click here.

But quite frankly, it’s surprising that there’s no simple manager that can cover those problematic for such a nice option (as there is one for network managing for instance), right ?

So… I did it ! 🙂

My program : Alias_Manager

I created a program to help users managing their aliases, both easily and securely. I made it as simple and intuitive as possible to install and use.

To install it, you just need to copy/paste the following command in your terminal (requires an internet connection and curl installed on your machine. The installation guide is available here) :

curl -s https://raw.githubusercontent.com/Antiz96/alias_manager/master/install_alias_manager.sh --output install_alias_manager.sh && chmod +x install_alias_manager.sh && source install_alias_manager.sh

Once it is installed, you can launch the program by typing the following command in your terminal :


From there, you can either choose to add a new alias by typing “add”, remove an alias by typing “remove” or list all your current aliases by typing “list”

You can also type “readme” to display some information about the program or you can quit the program by typing “exit”

Finally, you can type “update” to update the program (if an update is available) and type “uninstall” to… well… uninstall this program ! 🙂

Basically, the program will edit your .bashrc file and add or remove aliases for you (depending on what you asked for).

The .bashrc file is reloaded after each operation for an immediate application, this way you do not need to reboot or logoff/logon to use your new aliases.

A backup of your .bashrc file is created before each operations. It is deleted or restored depending on the success of each operations.

I’ll show you how to add and remove aliases (other options are pretty simple and self-explained).

By typing “add”, the program will ask you to type the name of the alias you want to add and the text/command you want it to be translated by. Example below with rc-linux = ls -ltr

The alias manager will take care of the rest 😉

By typing “remove”, the program will give you a list of all your current aliases and ask for the one you want to remove by typing its associated number (after a short disclaimer). Example below with rc-linux = ls -ltr

The alias manager will take care of the rest once again 😉

After each operations, the program will ask you if you want to do another one (relaunch the program automatically) or if you’re done and want to quit the program.

As I said earlier, the program will automatically create and manage backup of your .bashrc file before each operations so it will always be in a good state.

Also, pretty much all potential errors will be handled directly by the program. The alias manager will give you a hint on how to correct them and will let you retry.

Things to know before using the program :

– Your alias name cannot contain spaces, but can contain score “-” or underscore “_”

– Make sure that you typed correctly your alias name and the command you want to associate it with. This is the only error not handled by the program, as the alias you may want to create is completely your choice. If you created a wrong alias, you can remove it and re-create it via the program.

– Make sure you selected the right associated number when using the remove function. If you deleted an alias by mistake, you can recreate it via the program (check for the list above after you deleted it). Please read carefully the disclaimer before using the remove function.

– Be aware that aliases only applies for the user it has been created with. If you want to setup alias for a different user, you’ll need to install and use the program with this particular user (this program can obviously be installed and used by multiple users on the same machine).

– If you want to know more about this program or help me to improve it, please visit this link : https://github.com/Antiz96/alias_manager

And that’s it ! “Alias Manager” is a really simple and secure way to manage your aliases and I hope it will help you in any way !

Also, It was a lot of work !

So if you have any suggestions or comments about it, feel free to post them down below through the comment section, or contact me via the contact form.

PS : If you want to check my personal alias list, you can click here (for Debian/Ubuntu based distro) or here (for Arch Linux based distro) !

Robin Candau

Leave a Reply

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

Back to top