Bash Shell Customizing

I’ve had a request for a blog on how to update bash shell. I’ll put more into this in the future, but for now, here is the actual code in my .bashrc file.

Basically, I like to have my command line environment customized to my liking, just like any other user/administrator. So what I’ve done here is added some color to my shell, as well as added some nice, helpful and easy to remember aliases that really save time in typing.

Here is a screenshot of what my shell looks like:

Screenshot

#PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

# mint-fortune - If you like the fortunes, keep this on, otherwise delete it.
# you will need to have Mint Fortunes installed on your system for this to work
/usr/bin/mint-fortune

#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------


#[Color Prompt] This adds color prompt to your shell.
#    I've gone through and figured out a whole bunch
#    of colors so you can go ahead and customize to
#    your heart's content.

force_color_prompt=yes

#[Variables]
RESET="\[\017\]"
NORMAL="\[\033[;m\]"
LGREEN="\[\033[1;32m\]"
LGREEN0="\[\033[0;32m\]"
LBLUE="\[\033[1;34m\]"
LCYAN="\[\033[1;36m\]"
LRED="\[\033[1;31m\]"
LPURPLE="\[\033[1;35m\]"
BLACK="\[\033[0;30m\]"
BLUE="\[\033[0;34m\]"
GREEN="\[\033[0;32m\]"
CYAN="\[\033[0;36m\]"
PURPLE="\[\033[0;35m\]"
BROWN="\[\033[0;33m\]"
LGRAY="\[\033[0;37m\]"
DGREY="\[\033[01;30m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[01;33m\]"
WHITE="\[\033[01;37m\]"


#[Good Command]
SMILEY="${GREEN}:)${NORMAL}"

#[Bad Command]
FROWNY="${RED}:(${NORMAL}"

#[Command Judge]
SELECT="if [ \$? = 0 ]; then echo \"${SMILEY}\"; else echo \"${FROWNY}\"; fi"

#[Working PS1 output]
PS1="${RESET}${LCYAN}\u ${RED}@ ${LCYAN}\h: ${YELLOW}\w\a~ \`${SELECT}\` ${YELLOW}\$ ${GREEN} ${NORMAL} "


#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------


#[Aliases]
alias du="du -bchsS"
alias ll="ls -alhF --color=auto"
alias ..='cd ..'
alias ...='cd ../..'
alias dfah='df -ah'
alias mount='mount |column -t'
alias now='date +"%T'
alias nowdate='date +"%d-%m-%Y"'
alias vlspci='sudo lspci -vvnn'
alias vi=vim
alias disks='sudo blkid && sudo fdisk -l'

alias svi='sudo vi'
alias vis='vim "+set si"'
alias edit='vim'
alias ports='netstat -tulanp'
alias apt-get="sudo apt-get"
alias updatey="sudo apt-get --yes"
alias update='sudo apt-get update && sudo apt-get upgrade'
alias meminfo='free -m -l -t'
alias psmem='ps auxf | sort -nr -k 4'
alias psmem10='ps auxf | sort -nr -k 4 | head -10'
alias pscpu='ps auxf | sort -nr -k 3'
alias pscpu10='ps auxf | sort -nr -k 3 | head -10'
alias cpuinfo='lscpu'
##alias cpuinfo='less /proc/cpuinfo' ##
alias gpumeminfo='grep -i --color memory /var/log/Xorg.0.log'
alias reboot='sudo /sbin/reboot'
alias poweroff='sudo /sbin/poweroff'
alias halt='sudo /sbin/halt'
alias shutdown='sudo /sbin/shutdown'
alias tftpstuff='sudo chmod 777 /tftp/* && sudo chown root:root /tftp/*'


#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------

#[Backups] This section is where I have my backups defined.
#    For more information, please check out my "Backups"
#    blog. You can find it here:
#    http://www.erdmanor.com/blog/debian-backups-command-line-way/

alias backupall='sudo rsync -athvz --delete --exclude-from='backups/exclude.list' / /backups/computername/path/to/save/backups'

VN:F [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Bash Shell Customizing, 5.0 out of 5 based on 1 rating
Tagged , , , , . Bookmark the permalink.

Comments are closed.