Power-up your bash file

I have made my life considerably easier by adding some of my most-used bash commands to by bash_aliases file. Just remember to load this file in your bashrc file and you’re all set…

alias dev="cd ~/Development"

alias ssh_g="ssh user@10.193.152.32"

# console coloring
export PS1='\[\033[1;35m\]\h\[\033[1;33m\] \W\[\033[00m\] => '

# root file browser
alias ste="sudo gedit"
alias sn="sudo nautilus"

# edit bashrc
alias bn="nano ~/.bashrc"
alias bna="nano ~/.bash_aliases"

# edit hosts
alias hosts="sudo nano /etc/hosts"

# free memory
alias free="free -m"

# system helpers
alias update="sudo aptitude update"
alias install="sudo aptitude install"
alias upgrade="sudo aptitude update && sudo aptitude safe-upgrade"
alias remove="sudo aptitude remove"
alias clean="sudo aptitude clean"
alias search="sudo aptitude search"

# reload bash aliases
alias reload="source ~/.bashrc"

# git helpers
alias gu="git pull"
alias gp="git push"
alias ga="git add ."
alias gc="git commit -m \$1"
alias gs="git status"
alias gi="nano .gitignore"
alias gg="git gui &"
alias gk="gitk &"

alias gu_all="sso && gu && rd && gu && rt & gu & ws & gu"

# git config (globally)
alias ggmyname="git config --global user.name \$1"
alias ggmyemail="git config --global user.email \$1"

# git config (locally)
alias gmyname="git config user.name \$1"
alias gmyemail="git config user.email \$1"

# test cucumber features
alias ct="cucumber features -n"

# start ruby
alias rs="ruby script/server"
alias rc="ruby script/console"

# disk space and cls/clear
alias left="df -h"
alias cls="clear"

# flush dns cache
alias flushdns="sudo /etc/init.d/nscd restart"
alias installdnscache="sudo aptitude install nscd"

# logs
alias ld="tail -f log/development.log"
alias lp="tail -f log/production.log"
alias lt="tail -f log/test.log"
alias lc="tail -f log/cucumber.log"
alias lr="rm log/*.log"

# apache
alias ame="sudo a2enmod \$1"
alias amd="sudo a2dismod \$1"
alias ase="sudo a2ensite \$1"
alias asd="sudo a2dissite \$1"
alias arc="sudo /etc/init.d/apache2 reload"
alias arg="sudo apache2ctl graceful"
alias ars="sudo /etc/init.d/apache2 restart"

# capistrano
alias capsetup="cap deploy:setup"
alias capcheck="cap deploy:check"
alias capcold="cap deploy:cold"
alias capstop="cap deploy:stop"
alias capstart="cap deploy:start"

# rake
alias migrate="rake db:migrate"
alias migrate_t="rake db:migrate RAILS_ENV=test"
alias migrate_all="migrate && migrate_t"
alias redo="rollback && migrate"
alias rollback="rake db:rollback"
alias rollback_t="rake db:rollback RAILS_ENV=test"
alias redo_t="rollback_t && migrate_t"

# processes
alias pav="ps aux | grep \$1"

Simples!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s