Created
June 23, 2015 16:43
-
-
Save heyseus1/e872c05948520b106737 to your computer and use it in GitHub Desktop.
my bash_profile MACOSx
This file contains 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
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile | |
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* | |
#Bashrc | |
if [ -f ~/.bashrc ]; then | |
. ~/.bashrc | |
fi | |
complete -W "$(grep "^Host " ~/.ssh/config | awk '{ print $2 }' | xargs echo)" ssh | |
complete -W "$(grep "^Host " ~/.ssh/config | awk '{ print $2 }' | xargs echo)" gen_shc.sh | |
#alias | |
alias sub='open -a "Sublime Text"' | |
alias keePassX='open -a "KeePassX"' | |
alias vm='open -a "VMware Fusion"' | |
alias f='open -a Finder ./' | |
alias cic='set completion-ignore-case On' # cic: Make tab-completion case-insensitive | |
alias che='source ~/.bash_profile' | |
alias screensaver='/System/Library/Frameworks/ScreenSaver.framework/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -module Flurry' | |
alias cleanupLS="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" | |
#path | |
PATH=$HOME/Shared/bin:/opt/chef/bin:/opt/opseng/bin:/opt/chef-server/bin:/opt/chef-server/embedded/bin:$PATH:$HOME/bin:/sbin:/usr/sbin:/usr/local/sbin:/opt/MegaRAID/MegaCli | |
export PATH | |
# --------------------------- | |
# 5. PROCESS MANAGEMENT | |
# --------------------------- | |
# findPid: find out the pid of a specified process | |
# ----------------------------------------------------- | |
# Note that the command name can be specified via a regex | |
# E.g. findPid '/d$/' finds pids of all processes with names ending in 'd' | |
# Without the 'sudo' it will only find processes of the current user | |
# ----------------------------------------------------- | |
findPid () { lsof -t -c "$@" ; } | |
# memHogsTop, memHogsPs: Find memory hogs | |
# ----------------------------------------------------- | |
alias memHogsTop='top -l 1 -o rsize | head -20' | |
alias memHogsPs='ps wwaxm -o pid,stat,vsize,rss,time,command | head -10' | |
# cpuHogs: Find CPU hogs | |
# ----------------------------------------------------- | |
alias cpu_hogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10' | |
# topForever: Continual 'top' listing (every 10 seconds) | |
# ----------------------------------------------------- | |
alias topForever='top -l 9999999 -s 10 -o cpu' | |
# ttop: Recommended 'top' invocation to minimize resources | |
# ------------------------------------------------------------ | |
# Taken from this macosxhints article | |
# http://www.macosxhints.com/article.php?story=20060816123853639 | |
# ------------------------------------------------------------ | |
alias ttop="top -R -F -s 10 -o rsize" | |
# my_ps: List processes owned by my user: | |
# ------------------------------------------------------------ | |
my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ; } | |
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 weatherSF="curl -s 'http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=en|us|san-francisco-ca|94103' | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'" | |
alias weatherOak="curl -s 'http://rss.accuweather.com/rss/liveweather_rss.asp?metric=1&locCode=en|us|Oakland-ca|94612' | sed -n '/Currently:/ s/.*: \(.*\): \([0-9]*\)\([CF]\).*/\2°\3, \1/p'" | |
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 | |
} | |
ii() { | |
echo -e "\nYou are logged on ${RED}$HOST" | |
echo -e "\nAdditionnal information:$NC " ; uname -a | |
echo -e "\n${RED}Users logged on:$NC " ; w -h | |
echo -e "\n${RED}Current date :$NC " ; date | |
echo -e "\n${RED}Machine stats :$NC " ; uptime | |
echo -e "\n${RED}Current network location :$NC " ; scselect | |
echo -e "\n${RED}Public facing IP Address :$NC " ;myip | |
#echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns | |
echo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment