Skip to content

Instantly share code, notes, and snippets.

@gilbitron
Last active Jan 15, 2019
Embed
What would you like to do?
Mac OS X Bash Profile
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# PHP
export PATH="/Applications/MAMP/bin/php/php5.5.23/bin:$PATH"
# MySQL
export PATH="/Applications/MAMP/Library/bin:$PATH"
# Composer
export PATH="~/.composer/vendor/bin:$PATH"
# Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
# -------
# Aliases
# -------
alias cp="cp -iv" # Preferred "cp" implementation
alias mv="mv -iv" # Preferred "mv" implementation
alias mkdir="mkdir -pv" # Preferred "mkdir" implementation
alias ll="ls -FGlAhp" # List all files in current directory in long list format
alias ldir="ls -al | grep ^d" # List all directories in current directory in long list format
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
alias f="open ." # f: Open the current directory in Finder
alias ~="cd ~" # ~: Go Home
alias c="clear" # c: Clear terminal display
alias ip="curl icanhazip.com" # ip: Your public IP address
alias ut="uptime" # ut: Computer uptime
alias numfiles="echo $(ls -1 | wc -l)" # numfiles: Count of non-hidden files in current dir
alias edithosts="sudo nano /etc/hosts" # edithosts: Edit /etc/hosts file
mcd () { mkdir -p "$1" && cd "$1"; } # mcd: Makes new dir and jumps inside
# flushdns: Flush DNS (Yosemite)
alias flushdns="sudo dscacheutil -flushcache;sudo killall -HUP mDNSResponder;"
# 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
}
# ii: display useful host related informaton
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 " ; ip
}
# gitmd: git "merge and deploy"
gitmd() {
git checkout master
git merge --no-edit develop
git push
git checkout develop
}
# gruntw: run grunt and watch
gruntw() {
grunt && grunt watch
}
# ...
# If you use zsh add this to the bottom of ~/.zshrc
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
@djangofan
Copy link

djangofan commented Sep 1, 2018

What about this?

export PATH=".:/usr/local/bin:/usr/local:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/sw/bin:$PATH"
export PATH="$PATH:/usr/local/git/bin"
export PATH="$PATH:$HOME/.pyenv/shims" # add Python version manager
echo "Python shimmed: " + $(pyenv which python)
export PATH="$PATH:$HOME/.rbenv/bin" # add Ruby version manager
eval "$(rbenv init -)"
echo "Ruby shimmed: " + $(rbenv which ruby)
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "${SDKMAN_DIR}/bin/sdkman-init.sh" ]] && source "${SDKMAN_DIR}/bin/sdkman-init.sh"
echo "Available SDKMAN libs: " + $(ls ~/.sdkman/candidates)
echo "Available BREW libs: " + $(brew list && brew cask list)
echo "------------------"
echo ""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment