Skip to content

Instantly share code, notes, and snippets.

@nicnocquee
Last active April 24, 2017 06:51
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicnocquee/6b8f68a9b488b9a3543d0b42934f3ccf to your computer and use it in GitHub Desktop.
Save nicnocquee/6b8f68a9b488b9a3543d0b42934f3ccf to your computer and use it in GitHub Desktop.
my shell alias
# Color LS
colorflag="-G"
alias ls="command ls ${colorflag}"
alias l="ls -lF ${colorflag}" # all files, in long format
alias la="ls -laF ${colorflag}" # all files inc dotfiles, in long format
alias lsd='ls -lF ${colorflag} | grep "^d"' # only directories
alias lsa="command ls -la | lolcat"
# Quicker navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
# create tmp dir and cd to it
alias cdtmp=". /usr/local/bin/my_scripts/cd_to_tmp"
alias sourceprof="source ~/.bash_profile"
alias home="cd ~"
alias cdd="cd ~"
# Enable aliases to be sudo’ed
alias sudo='sudo '
# Colored up cat!
# You must install Pygments first - "sudo easy_install Pygments"
alias c='pygmentize -O style=monokai -f console256 -g'
# Git
# You must install Git first - ""
alias gs='git status | lolcat'
alias ga='git add .'
alias gc='git commit -m' # requires you to type a commit message
alias gp='git push'
alias gl='git log --pretty=format:"%h - %an, %ar : %s" | more'
alias gorigin='git remote get-url origin'
alias grm='git rm $(git ls-files --deleted)'
# show and hide hidden files
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
# backup cheat dir
alias backupcheat='cd ~/.cheat && ga && gc "update" && gp'
# backup .bash_profile .alias .prompt .path .bashrc
alias backupprofile='cdtmp && git clone <git_url> && cd bash && cp ~/.bashrc . && cp ~/.prompt . && cp ~/.bash_profile . && cp ~/.alias . && cp ~/.path . && ga && gc "update" && gp'
# backup my_scripts
alias backupmyscript='cd /usr/local/bin/my_scripts && ga && gc "update" && gp'
# backup Alfred 3 workflows
alias backupworkflows='cdtmp && git clone <git_url> && cd workflows && cp -R /Users/nico/Library/Application\ Support/Alfred\ 3/Alfred.alfredpreferences/workflows/* . && ga && gc "update" && gp'
# brew clean up
alias brewup="brew update && brew doctor && brew outdated && brew upgrade && brew cleanup"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment