Skip to content

Instantly share code, notes, and snippets.

@monte-hayward
Last active February 25, 2016 19:40
Show Gist options
  • Save monte-hayward/3c2d58ed48d826cdae8f to your computer and use it in GitHub Desktop.
Save monte-hayward/3c2d58ed48d826cdae8f to your computer and use it in GitHub Desktop.
Handy Aliases for OS X bash 4
#!/bin/bash
export PS1=\$
## CONVENIENCE ALIASES for Bash 4 on OS X ##
## Monte Hayward
alias justnow='history | sort -nr | less'
alias envbash='source ~/.bash_profile'
alias see='ls -lpa $1' # list hidden files
alias nu='ls -lposth . | head' # list n newest files
alias lsd="ls -p $1 | grep '/'" # list only directories
alias ll="ls -lp" # list in long format
alias bigfiles='ls -posSh' # list files in descending order of size
alias biggest='du -csm ./* |sort -nr| head -30' # recursively list file and directory sizes, rounded to nearest MB
alias smallest='du -csm ./* |sort -n| head -30' # recursively list file and directory sizes, rounded to nearest MB
alias clipboardclean='pbpaste | pbcopy' # remove styling, leaving text in clipboard
alias charcount='pbpaste | wc -c' # count characters in clipboard
alias wordcount='pbpaste | wc -w' # count words in clipboard
alias hide='clear;history -c' # clear command history
ef() {
vi "$(find . -iname $1)"
}
alias editfile=ef # recursively search for a filename, and edit it in vim
alias dotfilesshow='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias dotfilehide='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
## LANGUAGES and FRAMEWORKS
### PYTHON
# Setting PATH for Python 2.7 for Development (outside OS X protected versions)
# prefer brew versions, except Python. http://stackoverflow.com/questions/32898583/unable-to-install-nltk-on-mac-os-el-capitan/33379505#33379505
# The orginal version is saved in .bash_profile.pysave
export PYTHONDEV=$HOME/Library/Frameworks/Python.framework/Versions/Current/bin #Current is symlink to 2.7, which contains 2.7.11
export PIPDEV=$HOME/Library/Frameworks/Python.framework/pip #7.2.1
export PYTHON_USER_TARGET=$HOME/Library/Python/2.7/bin # pip install foo --user installs here. --only-binary
export PYTHONPATH="~/Library/Caches/:./.pip" # Allow project-local install of dependencies. http://blog.zoomeranalytics.com/pip-install-t/
export PATH="$PYTHONDEV:$PIPDEV:${PATH}:$PYTHON_USER_TARGET_HOME" # ignore OS-protected python. Prefer project-local versions, then --user ones.
alias pyenv="~/bin/pythonenv.bash"
## NODEJS
NPM_PACKAGES="$HOME/.npm-packages"
export PATH="$HOME/.node_modules_global/bin:$PATH"
## GENERAL
## ARBITRARY USER SCRIPTS
export PATH=$PATH:$HOME/bin
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then . ~/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment