Custom bash_profile for Advanced Shell Users
Looking for some advanced uses for the shell? Here is some of my best. Works for all shells I encounter, including BackTrack, Debian, Knoppix, Arch Linux, etc. Also works for many hosting environments I use including DreamHost, HostGator, WiredTree, and pretty much any linux VPS.
Want to get started? Type the following in your shell to download the script and run it. You should go over the code first and then you can just save it as your .bash_profile - whenever you want to get updated to the latest version just type aaup, a cool update function that auto dos2unix's and runs via an exec command.
curl -O https://www.askapache.com/s/s.askapache.net/askapache-bash-profile.txt && source askapache-bash-profile.txt Or if you trust me and my hosting provider (and you aren't on production) curl -o ~/.bash_profile https://www.askapache.com/s/s.askapache.net/askapache-bash-profile.txt && exec bash -l
For those of you power users and server admins that use Bash, ksh, csh, vanilla sh, etc.., or if you are just passionate about shell scripting, because it allows you to get advanced tasks done fast and efficiently, not to mention automated automatically. I give you my .bash_profile file. You should edit it to fit your needs, (especially the exported vars like PATH, LDFLAGS, if you don't understand something just comment it out) but it's pretty universal because I work on alot of other people's servers not to mention many different distros and platforms, and when I get hired to do some server work through a shell, I bring this script along for the ride.
askapache-bash-profile.txt
You can download the latest version: https://www.askapache.com/s/s.askapache.net/askapache-bash-profile.txt
The functions and variables below are the way bash sees them, using declare -f, and alias, to make it easier for you to read and understand them. The actual file at https://www.askapache.com/s/s.askapache.net/askapache-bash-profile.txt will always be the most updated version, as I use it personally. And it has the whole file the way I wrote it, meaning many extra notes and much simpler to follow. Enjoy!
Gist of the Script..
I also rely on this heavily from within shell scripts I write to access all the functions and stuff in this .bash_profile, and to do that I just do like:
#!/bin/bash source ~/.bash_profile &>/dev/nulll pm "PM is a function to output nice messages with color" yn "Are you enjoying the shell" && pm "Thats great!" || pm "Perhaps you're better suited for DOS" yn "Show Calendar" && aa_calendar yn "Show Fortune" && aa_fortune
alias chmod='command chmod -c' alias cpr='command cp -rpv' alias df='command df -kTh' alias df1='command df -iTa' alias diff='diff -up' alias dsiz='du -sk * | sort -n --' alias du='command du -kh' alias du1='echo *|tr " " "n" |xargs -iFF command du -hs FF|sort' alias env='command env | sort' alias h='history' alias inice='ionice -c3 -n7 nice' alias j='jobs -l' alias la='command ls -Al --color=auto' alias lc='command ls -lAcr --color=auto' alias less='vless' alias lessc='ccze -A |`type -P less` -R' alias lk='command ls -lASr --color=auto' alias llh='ll -h' alias lll='stat -c %a %N %G %U ${PWD}/*|sort' alias lr='command ls -lAR --color=auto' alias lt='command ls -lAtr --color=auto' alias lu='command ls -lAur --color=auto' alias lx='command ls -lAXB --color=auto' alias mann='command man -H' alias n='/usr/bin/nano3' alias p='command ps -HAcl -F S -A f|uniq -w3' alias path='echo -e ${PATH//:/\n}' alias php='php -d report_memleaks=1 -d report_zend_debug=1 -d log_errors=0 -d ignore_repeated_errors=0 -d ignore_repeated_source=0 -d error_reporting=30719 -d display_startup_errors=1 -d display_errors=1' alias pp='command ps -HAcl -F S -A f' alias ps1='command ps -lFA' alias ps2='command ps -H' alias resetw='echo $'''33[H33[2J'''' alias subash='sudo sh -c '''export HOME=/root; cd /root; exec bash -l'''' alias top='top -c' alias tree='command tree -Csuflapi' alias updatedb='( ( updatedb 2>/dev/null ) & )' alias vim='command vim --noplugin' alias who='command who -ar -pld' alias wtf='watch -n 1 w -hs'
« Update: Best Free Online BankingVetted – Top 3 WordPress Speed Plugins »
Comments