Last active
September 15, 2025 23:55
-
-
Save bugspencer/9157276 to your computer and use it in GitHub Desktop.
BASH: .bash_profile
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
| parse_git_branch() { | |
| git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' | |
| } | |
| export PS1="---- (\u @ \h) ------------------------------ \d \T ----\n| \w \[\033[32m\]\$(parse_git_branch)\[\033[00m\] \n| > " | |
| alias cp='cp -iv' | |
| alias mv='mv -iv' | |
| alias mkdir='mkdir -pv' | |
| alias ll='ls -FGlAhp' | |
| cd() { builtin cd "$@"; ll; } | |
| alias ~='cd ~' | |
| alias cd..='cd ../' | |
| alias ..='cd ../' | |
| alias ...='cd ../../' | |
| alias .3='cd ../../../' | |
| alias .4='cd ../../../../' | |
| alias .5='cd ../../../../../' | |
| alias .6='cd ../../../../../../' | |
| alias gnode='cd /usr/local/lib/node_modules' | |
| cdf () { | |
| currFolderPath=$( /usr/bin/osascript <<" EOT" | |
| tell application "Finder" | |
| try | |
| set currFolder to (folder of the front window as alias) | |
| on error | |
| set currFolder to (path to desktop folder as alias) | |
| end try | |
| POSIX path of currFolder | |
| end tell | |
| EOT | |
| ) | |
| echo "cd to \"$currFolderPath\"" | |
| cd "$currFolderPath" | |
| } | |
| alias s='open -a Sublime\ Text\ 2' | |
| alias f='open -a Finder ./' | |
| alias st='open -a SourceTree .' | |
| edit(){ s "$@"; } | |
| alias DT='tee ~/Desktop/terminalOut.txt' | |
| rmd () { rm -rf "$1"; } | |
| mtt () { command mv "$@" ~/.Trash ; } | |
| ql () { qlmanage -p "$*" >& /dev/null; } | |
| mcd () { mkdir -p "$1" && cd "$1"; } | |
| alias c='clear' | |
| zipit () { zip -r "$1".zip "$1" ; } | |
| alias filesCount='echo $(ls -1 | wc -l)' | |
| alias make1mb='mkfile 1m ./1MB.dat' | |
| alias make5mb='mkfile 5m ./5MB.dat' | |
| alias make10mb='mkfile 10m ./10MB.dat' | |
| makefile() { mkfile "$1" ./"$2";} | |
| 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 | |
| } | |
| alias ffq='find . -name ' | |
| ff () { /usr/bin/find . -name "$@" ; } | |
| ffs () { /usr/bin/find . -name "$@"'*' ; } | |
| ffe () { /usr/bin/find . -name '*'"$@" ; } | |
| # pidf () { lsof -t -c "$@" ; } | |
| # alias memHogsTop='top -l 1 -o rsize | head -20' | |
| # alias memHogsPs='ps wwaxm -o pid,stat,vsize,rss,time,command | head -10' | |
| # alias cpu_hogs='ps wwaxr -o pid,stat,%cpu,time,command | head -10' | |
| # alias topForever='top -l 9999999 -s 10 -o cpu' | |
| # alias ttop="top -R -F -s 10 -o rsize" | |
| # my_ps() { ps $@ -u $USER -o pid,%cpu,%mem,start,time,bsdtime,command ; } | |
| alias netip='curl ip.appspot.com' | |
| alias netcons='lsof -i' | |
| alias netflushdns='dscacheutil -flushcache' | |
| alias netlsock='sudo /usr/sbin/lsof -i -P' | |
| alias netlsockU='sudo /usr/sbin/lsof -nP | grep UDP' | |
| alias netlsockT='sudo /usr/sbin/lsof -nP | grep TCP' | |
| alias netinfoen0='ipconfig getpacket en0' | |
| alias netopenports='sudo lsof -i | grep LISTEN' | |
| alias netshowblocked='sudo ipfw list' | |
| 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 " ;netip | |
| # echo -e "\n${RED}DNS Configuration:$NC " ; scutil --dns | |
| echo | |
| } | |
| alias cleanDS="find . -type f -name '*.DS_Store' -ls -delete" | |
| alias showHidden='defaults write com.apple.finder ShowAllFiles TRUE' | |
| alias hideHidden='defaults write com.apple.finder ShowAllFiles FALSE' | |
| alias ehosts='sudo vim /etc/hosts' | |
| httpHeaders () { /usr/bin/curl -I -L $@ ; } | |
| httpDebug () { /usr/bin/curl $@ -o /dev/null -w "dns: %{time_namelookup} connect: %{time_connect} pretransfer: %{time_pretransfer} starttransfer: %{time_starttransfer} total: %{time_total}\n" ; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment