I’ve always been a big fan of having a customized .bashrc file. The one I distribute to all of my servers has aliases for quick commands to save me time on the command line, functions that get work done when aliases are too simplistic, reporting for the server for each cli login, and of course a formatted and colored prompt (for terms that support colors). I also change certain aspects and commands based on the operating system since I’m not always on a redhat box or linux at all. Here’s my bashrc file – maybe you have some fun additions that you’d like to share. What saves you time on the command line?
[...] This post was mentioned on Twitter by programes, Zuissi. Zuissi said: MySQL: Fun with Bash: aliases make your live easier… share your favorites: I’ve always been a big fan of having … http://bit.ly/hhfqQ4 [...]
the netinfo() is a neat one! thanks
Always interesting to see others’ aliases. Here’s a few of my most frequently used:
alias ..=’cd ..’
alias …=’cd ../..’
(ad infinitum)
alias xargs=’xargs -0tr’
alias graceful=’/etc/init.d/httpd configtest && /etc/init.d/httpd graceful’
alias apache_modules=’apachectl -t -D DUMP_MODULES’
alias whois=’whois -h whois.geektools.com’
alias watch_mysql=’watch -n1 “cat /proc/loadavg && echo && mysqladmin processlist –verbose=true | sed \”/show full processlist/d\”"‘
alias listening=’lsof -Pan -i tcp -i udp’
alias slymap=’nmap -T4 -A -v -PN’
alias quickmap=’nmap -T4 -F’
alias scp=”rsync –partial –progress –rsh=ssh”
Here’s my time saver.
I keep a file with the list of hosts ( ~/.hosts )I have to log into and then execute the following:
for SERVERS in `cat ~/.hosts`; do alias $SERVERS=”ssh -X -A $SERVERS”; done
The “-X” can be removed. Now I just type the hostname to login. The ~/.hosts file also allows me to do things like:
for SERVERS in `grep something ~/.hosts`; do ssh $SERVERS ; done
To run a set of commands on a group of servers.
My $.02
For me the largest command line time (and life) saver probably still is the “path” utility and the little wrappers around it that i described in:
http://www.php-groupies.de/blogs/archives/1-The-PATH-is-the-reward.html
thanks for the file!
Haha Funny concept! I also change certain aspects and commands based on the operating system since I’m not always on a redhat box or linux at all. Thanks!