Last active
November 19, 2015 14:03
-
-
Save andrey-str/1b352090be5873298527 to your computer and use it in GitHub Desktop.
Useful aliases for bash .profile
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
# common alaises | |
# up one level | |
alias ..="cd .." | |
# unload cacher applications preferences on Yosemite and up(maybe on Maverick too) | |
alias fixpref='killall -u andrey cfprefsd' | |
# refresh locate database | |
alias updatedb=open_in_appcode | |
# detailed directory listing | |
alias ll="ls -l" | |
# reload bash .profile | |
alias reloadprofile="source ~/.profile" | |
# Open in AppCode alias /****** | |
# References: | |
# How to hide command output in bash: http://stackoverflow.com/questions/18062778/how-to-hide-command-output-in-bash | |
# Make bash alias that takes parameter: http://stackoverflow.com/questions/7131670/make-bash-alias-that-takes-parameter | |
# Expand a possible reltive path in bash: http://stackoverflow.com/questions/7126580/expand-a-possible-relative-path-in-bash | |
function abspath { | |
if [[ -d "$1" ]] | |
then | |
pushd "$1" >/dev/null | |
pwd | |
popd >/dev/null | |
elif [[ -e $1 ]] | |
then | |
pushd "$(dirname "$1")" >/dev/null | |
echo "$(pwd)/$(basename "$1")" | |
popd >/dev/null | |
else | |
echo "$1" does not exist! >&2 | |
return 127 | |
fi | |
} | |
open_in_appcode(){ | |
/Applications/AppCode.app/Contents/MacOS/appcode `abspath $1` &> /dev/null | |
} | |
alias appcode=open_in_appcode | |
# --- End *********************/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment