Friday, September 9, 2011

Creating custom commands

When using CLI of linux based OS', some regular commands that we perform everyday, even multiple times everyday, becomes a burden to type again and again. Luckily we have a simple way to ease up small stuff like that.

Let's assume that we're doing some work on our web site that has database interaction, and each time we change a configuration setting we need to restart the httpd and db services.


#service httpd restart
#service postgresql-9.0 restart

Typing 6 words every time. I am too lazy for that kind of stuff. Instead I created a new alias in the .bashrc file in my home folder. if you have a look at your profiles .bashrc file, you'll most likely see other aliases already configured by default. So just add another line, and log off/on or source that file.

#cd /root
#vi .bashrc


....

alias mv='mv -i'
alias rm='rm -i'
alias mycustomcommand='service httpd restart; service postgresql-9.0 restart'
.....

#source .bashrc

This simple tweak will definitely come in handy.


4 comments:

Anonymous said...

[url=http://cialisnowdirect.com/#zxlwv]buy cheap cialis[/url] - cheap cialis online , http://cialisnowdirect.com/#ncorl cialis 20 mg

Anonymous said...

[url=http://levitranowdirect.com/#ixomc]order levitra[/url] - cheap levitra , http://levitranowdirect.com/#oaeng levitra 10 mg

Anonymous said...

[url=http://viagranowdirect.com/#hjqiu]viagra 150 mg[/url] - cheap viagra online , http://viagranowdirect.com/#nbtju cheap generic viagra

Anonymous said...

[url=http://paydayloansheredirectly.com/#eisyh]payday loans[/url] - payday loans , http://paydayloansheredirectly.com/#uqitk payday loans