'alias' to do anything faster

alias is a linux/unix tool which helps to assign very long line-commands to a name. It helps to save huge lot of time and typing.
For example   alias  play ='find -type f -iname "*.mp3" -exec mplayer {}\;'   will play every mp3 file in the current directory with mplayer just by executing play in terminal; i.e instead typing the long command on the right side of '='  you only have to type play.
To make an alias permanent you have to include and  save it in .bashrc file in home folder.

I am giving some examples which I personally  found very useful

alias go ='gnome-open'
gnome-open opens files and URLs by the default application; i.e instead of gedit foo.txt and evince foo.pdf we just have to execute  go foo.txt and go foo.pdf.You dont need to know all the names of applications installed in your system!!Make sure that gnome-open is installed else install it by sudo apt-get install libgnome2-0 ( Ubuntu ) in terminal or through Software Centre ( Ubuntu ) or Add/Remove Software ( Fedora ).


alias u ='sudo apt-get update;sudo apt-get -y upgrade'
 Execute u in terminal to update and upgrade your system.


alias S='sudo shutdown -h now'
Just executing S in terminal will shutdown your system.You will have to type password after executing S.


alias R='sudo shutdown -r now'
Executing R in terminal will restart your system


alias T='rm -rf /home/$USER/.local/share/Trash/files/*'
executing T in terminal will empty your trash bin


alias say='espeak -s 95 -v en+f2'
Now executing say "this is good" will make you hear a sweet female voice saying this is cool!!


alias ahora='truecrypt /media/Education/Ahora;nautilus /media/truecrypt1'
executing ahora will open truecrypt window for entering password.After entering the correct password the truecrypt volume will be opened in nautilus.(in this example truecrypt volume name is Ahora in /media/Education/)


alias gcheck='curl -u username --silent "https://mail.google.com/mail/feed/atom" | grep -E "title|email"'
This is the fastest method to check whether you have recieved any new mail in your gmail account.Just execute gcheck in terminal.Replace username with your real username.


alias bbc='vlc http://www.radiofeeds.co.uk/ws.asx' 
or
alias bbc='mplayer -playlist http://www.radiofeeds.co.uk/ws.asx'
Now execute bbc in terminal to listen to BBC Radio World Service in vlc media player or mplayer.



Now that is not all !! Visit http://www.commandlinefu.com/commands/browse . You can get wonder struck seeing so much line commands!! Search for commands that you require and assign an alias to it.Your life is going to get smoother and faster!!


Enjoy Linux!!

No comments:

Post a Comment