Create Your own Commands with Alias on Linux
Alias command allows us to create our own custom commands.This is really very useful.If you are regular Linux user or administrator then it should help you.
We can create aliases of just about any linux command you can think of. Not only commands also the application that is installed in your system you can create custom commands for everything.
Create an alias for Firefox
Firefox is default web browser for almost every Linux distribution.So in order to open firefox from your terminal you typr firefox but it can be made a little easier with alias.Follow the below command:
root@seven:~# alias web='firefox'
When you execute the above command the command firefox gets assigned to the web.So now you dont have to type firefox in order to start firefox.Just web will do it.
So when i write web my firefox starts.You can assign any name even a single character will do it.
Making switching easy with alias
Lets you want to change your directory to Desktop then regular syntax goes like this:
cd Desktop it's kind of lengthy i mean we can make to easier.Just follow the below command:
root@seven:~# alias desk='cd Desktop'
Now you dont have to type cd Desktop to switch desktop.Just desk will do it.
root@seven:~# desk root@seven:~/Desktop#
List created aliases
If you want to know about aliases that you created just type alias.It will list all the aliases created by you
root@seven:~# alias alias desk='cd Desktop' alias ls='ls --color=auto' alias web='firefox'
If you want to get rid of aliases then follow the below command:
root@seven:~# unalias web
Just give the command that you want to unalias along with unalias command.
That's it guys use your imagination and create some useful aliases.