Last active
August 29, 2015 14:03
-
-
Save wgallios/8b0fdddd0d383a9aaefc to your computer and use it in GitHub Desktop.
custom .bashrc stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # changes "ls" functionality to include flags "ls -AlFh" | |
| if [ "$TERM" != "dumb" ]; then | |
| eval `dircolors -b` | |
| export LS_OPTIONS='-AlFh --color=always' | |
| alias ls='ls $LS_OPTIONS' | |
| fi | |
| alias lsd='ls -AlFh --color | grep ^drw' | |
| alias lsnd='ls -AlFh --color | grep -v ^drw' | |
| alias cleanvim='find . -name "*.swp" -type f -delete' | |
| alias rehash='source ~/.bashrc' | |
| alias gitmod='git status | grep modified' | |
| alias cdv='cd /var/www' | |
| alias bsh='vim + ~/.bashrc' | |
| alias vimrc='vim + ~/.vimrc' | |
| # lists all the global npm packages installed | |
| alias globalnpm='ls /usr/local/lib/node_modules/' | |
| # function to quickly switch web folders | |
| _cdw () { | |
| local cur=${COMP_WORDS[COMP_CWORD]} | |
| local pdir=/var/www | |
| COMPREPLY=( $(compgen -W "$(ls $pdir)" -- $cur) ) | |
| } | |
| # autocomplete for log function | |
| _log () { | |
| local cur=${COMP_WORDS[COMP_CWORD]} | |
| local ldir=/var/www | |
| COMPREPLY=( $(compgen -W "$(ls $ldir)" -- $cur) ) | |
| } | |
| complete -F _cdw cdw | |
| complete -F _log log | |
| function log { multitail -C -f /var/log/$1/$1.log; } | |
| function portCheck { sudo netstat -tapen | grep ":$1 "; } | |
| function portOpen { sudo iptables -A INPUT -p tcp --dport $1 -j ACCEPT; } | |
| function portListen { sudo netstat -ntlp | grep LISTEN; } | |
| function cdw { cd /var/www/$1; } | |
| function installsshkey { | |
| echo "Installing SSH Key to $1" | |
| < ~/.ssh/id_rsa.pub ssh $1 -p $2 'mkdir -p .ssh; cat >> .ssh/authorized_keys; chmod go-w .ssh .ssh/authorized_keys'; | |
| } | |
| export -f log | |
| export -f portCheck | |
| export -f portOpen | |
| export -f portListen | |
| export -f cdw | |
| export -f installsshkey | |
| #shows git branch | |
| source /etc/bash_completion.d/git | |
| green='\e[0;32m' # Green | |
| yellow='\e[0;33m' # Yellow | |
| white='\e[0;37m' # White | |
| color_off='\e[0m' # Color Reset | |
| GIT_PS1_SHOWDIRTYSTATE=true | |
| PS1="\u@\h:\w\[${yellow}\]"'$(__git_ps1)'"\[${white}\]\$ \[${color_off}\]" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment