Last active
February 26, 2016 20:41
-
-
Save hayespotter/3c0f51bd0cef906f5173 to your computer and use it in GitHub Desktop.
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
| #set default editor to nano | |
| export EDITOR=/usr/bin/nano | |
| alias reload='source ~/.bash_profile' | |
| alias reboot="sudo shutdown -r now" | |
| alias off="sudo shutdown -h now" | |
| alias ls='ls -FGlAhp' | |
| alias ttop="top -R -F -s 10 -o rsize" | |
| alias top="htop" | |
| alias df="pydf" | |
| alias du="du -ach | sort -h" | |
| alias free="free -mt" | |
| alias ps="ps auxf" | |
| alias psg="ps aux | grep -v grep | grep -i -e VSZ -e" | |
| alias mkdir="mkdir -pv" | |
| alias wget="wget -c" | |
| alias histg="history | grep" | |
| alias cd..='cd ../' # Go back 1 directory level (for fast typers) | |
| alias ..='cd ../' # Go back 1 directory level | |
| alias ...='cd ../../' # Go back 2 directory levels | |
| alias .3='cd ../../../' # Go back 3 directory levels | |
| alias .4='cd ../../../../' # Go back 4 directory levels | |
| alias .5='cd ../../../../../' # Go back 5 directory levels | |
| alias .6='cd ../../../../../../' # Go back 6 directory levels | |
| zipf () { zip -r "$1".zip "$1" ; } # zipf: To create a ZIP archive of a folder | |
| # extract: Extract most know archives with one command | |
| # --------------------------------------------------------- | |
| extract () { | |
| if [ -f $1 ] ; then | |
| case $1 in | |
| *.tar.bz2) tar xjf $1 ;; | |
| *.tar.gz) tar xzf $1 ;; | |
| *.bz2) bunzip2 $1 ;; | |
| *.rar) unrar e $1 ;; | |
| *.gz) gunzip $1 ;; | |
| *.tar) tar xf $1 ;; | |
| *.tbz2) tar xjf $1 ;; | |
| *.tgz) tar xzf $1 ;; | |
| *.zip) unzip $1 ;; | |
| *.Z) uncompress $1 ;; | |
| *.7z) 7z x $1 ;; | |
| *) echo "'$1' cannot be extracted via extract()" ;; | |
| esac | |
| else | |
| echo "'$1' is not a valid file" | |
| fi | |
| } | |
| # --------------------------- | |
| # 6. NETWORKING | |
| # --------------------------- | |
| alias myip='curl ip.appspot.com' # myip: Public facing IP Address | |
| alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets | |
| alias flushDNS='dscacheutil -flushcache' # flushDNS: Flush out the DNS Cache | |
| alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets | |
| alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets | |
| alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets | |
| alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0 | |
| alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1 | |
| alias openPorts='sudo lsof -i | grep LISTEN' # openPorts: All listening connections | |
| alias showBlocked='sudo ipfw list' # showBlocked: All ipfw rules inc/ blocked IPs | |
| alias ports='netstat -tulanp' | |
| # Repeat a command N times. You can do something like | |
| # repeat 3 echo 'hi' | |
| function repeat() | |
| { | |
| local i max | |
| max=$1; shift; | |
| for ((i=1; i <= max ; i++)); do | |
| eval "$@"; | |
| done | |
| } | |
| mcd () { | |
| mkdir -p $1 | |
| cd $1 | |
| } | |
| ## vagrant stuff | |
| alias vu='vagrant up' | |
| alias vh='vagrant halt' | |
| alias vd='vagrant destroy' | |
| alias vs='vagrant ssh' | |
| alias vp='vagrant suspend' | |
| alias vr='vagrant resume' | |
| # show which commands you use the most | |
| alias freq='cut -f1 -d" " ~/.bash_history | sort | uniq -c | sort -nr | head -n 30' | |
| # Add to grep: color, line numbers, context of 1 line | |
| alias grep="grep --color -n -B 1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment