Created
December 17, 2015 03:48
-
-
Save RupGautam/7c49d3b488c6a8209c1f to your computer and use it in GitHub Desktop.
collections of zsh aliases | alias shortcuts collections
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
| # Easier navigation: .., ..., ...., ....., ~ and - | |
| alias sudo='sudo ' #First thing | |
| alias ..="cd .." | |
| alias ...="cd ../.." | |
| alias ....="cd ../../.." | |
| alias .....="cd ../../../.." | |
| alias ~="cd ~" # `cd` is probably faster to type though | |
| alias -- -="cd -" | |
| alias ls="gls --color=auto" | |
| # Shortcuts | |
| alias d="cd ~/Dropbox" | |
| alias dl="cd ~/Downloads" | |
| alias dt="cd ~/Desktop" | |
| alias p="cd ~/projects" | |
| alias g="git" | |
| alias h="history" | |
| alias j="jobs" | |
| alias vm="cd ~/Projects/VMboxes" | |
| alias gist="sudo gist -s -o" #uploading text/scripts to gist.github.com | |
| # Files that I often edit | |
| alias edit_hosts='e /etc/hosts' | |
| #alias edit_httpd='edit /etc/apache2/httpd.conf' #no more, do vagrant | |
| #alias edit_php='edit /etc/php.ini' #no more, do vagrant | |
| #alias edit_vhosts='edit /etc/apache2/extra/httpd-vhosts.conf' #no more, do vagrant | |
| alias edit_alias='e ~/.aliases' | |
| #Port monitor | |
| alias wtf_slow='sudo lsof -iTCP -sTCP:LISTEN -P' #that's actually why_the_fu$k = wtf | |
| # Speed-up Terminal load time by clearing system logs | |
| alias speedup="sudo rm -rf /private/var/log/asl/*" | |
| #Shortcut to Icon-gen | |
| alias icon-gen="/usr/local/bin/icon-gen.sh" # for more details @https://gist.github.com/RupGautam/0fbfd89d1a84a62e57a2 | |
| #Secure password generator; cuz I'm too lazy to be creative on passwords. | |
| alias password="pwgen --ambiguous --capitalize --numerals --symbols 16 30" | |
| # Create lamp-stack from single command line; Cool right?? #TODO: lots to do. (It's not fully working) | |
| alias lamp="curl -L -o 'script.sh' https://gist.githubusercontent.com/RupGautam/08d6fc28fc2ee04e341a/raw/bcd2fec046517737925949fa9dbb4a2a3d49a2d3/script.sh && curl -L -o 'Vagrantfile' https://gist.githubusercontent.com/RupGautam/08d6fc28fc2ee04e341a/raw/bcd2fec046517737925949fa9dbb4a2a3d49a2d3/Vagrantfile && vagrant up" | |
| # Show/Hide hidden (dot) files in Finder | |
| alias showfiles="defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder" | |
| alias hidefiles="defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder" | |
| # Show/Hide Desktop icons | |
| alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder" | |
| alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder" | |
| #Curl IP by doing myip | |
| alias myinfo="curl http://ip-api.com/line" | |
| alias ip="curl icanhazip.com" | |
| alias localip="ipconfig getifaddr en1" | |
| # This alias recursively destroys all .DS_Store files | |
| alias killDS="sudo find . -type f -name '*.DS_Store' -ls -delete" | |
| # Show/Hide Dock | |
| alias hidedock="defaults write com.apple.dock autohide -bool false && killall Dock" | |
| alias showdock="defaults write com.apple.dock autohide -bool false && killall Dock" | |
| # Flush DNS | |
| alias flushDNS="sudo killall -HUP mDNSResponder;say cache flushed" | |
| #Open editable files with Sublime Text | |
| alias e='open -a Sublime\ Text' | |
| #Update the Whole system with single update command (update brew update osx) | |
| alias update="sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup" | |
| # Speedtest shortcuts | |
| alias speed="speedtest-cli --share" | |
| # Open Preview app for man. Example: manpdf "history" should open up nicely printed pdf in preview | |
| alias preview="open -f -a preview" | |
| manpdf() { | |
| man -t $1 | preview | |
| } | |
| #No more ls | color configs More @https://github.com/seebi/dircolors-solarized | |
| # Always enable colored `grep` output | |
| # Note: `GREP_OPTIONS="--color=auto"` is deprecated, hence the alias usage. | |
| alias grep='grep --color=auto' | |
| alias fgrep='fgrep --color=auto' | |
| alias egrep='egrep --color=auto' | |
| # Enable aliases to be sudo’ed | |
| alias sudo='sudo ' | |
| # Get week number | |
| alias week='date +%V' | |
| # Stopwatch | |
| alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' | |
| # Get OS X Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages | |
| alias update='sudo softwareupdate -i -a; brew update; brew upgrade --all; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update' | |
| # IP addresses | |
| alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" | |
| # Clean up LaunchServices to remove duplicates in the “Open With” menu | |
| alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" | |
| # View HTTP traffic | |
| alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" | |
| alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" | |
| # Canonical hex dump; some systems have this symlinked | |
| command -v hd > /dev/null || alias hd="hexdump -C" | |
| # OS X has no `md5sum`, so use `md5` as a fallback | |
| command -v md5sum > /dev/null || alias md5sum="md5" | |
| # OS X has no `sha1sum`, so use `shasum` as a fallback | |
| command -v sha1sum > /dev/null || alias sha1sum="shasum" | |
| # JavaScriptCore REPL | |
| jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc"; | |
| [ -e "${jscbin}" ] && alias jsc="${jscbin}"; | |
| unset jscbin; | |
| # Trim new lines and copy to clipboard | |
| alias c="tr -d '\n' | pbcopy" | |
| # Recursively delete `.DS_Store` files | |
| alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" | |
| # Empty the Trash on all mounted volumes and the main HDD. | |
| # Also, clear Apple’s System Logs to improve shell startup speed. | |
| # Finally, clear download history from quarantine. https://mths.be/bum | |
| alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'" | |
| # URL-encode strings | |
| alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' | |
| # Merge PDF files | |
| # Usage: `mergepdf -o output.pdf input{1,2,3}.pdf` | |
| alias mergepdf='/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/join.py' | |
| # Disable Spotlight | |
| alias spotoff="sudo mdutil -a -i off" | |
| # Enable Spotlight | |
| alias spoton="sudo mdutil -a -i on" | |
| # PlistBuddy alias, because sometimes `defaults` just doesn’t cut it | |
| alias plistbuddy="/usr/libexec/PlistBuddy" | |
| # Ring the terminal bell, and put a badge on Terminal.app’s Dock icon | |
| # (useful when executing time-consuming commands) | |
| alias badge="tput bel" | |
| # Kill all the tabs in Chrome to free up memory | |
| # [C] explained: http://www.commandlinefu.com/commands/view/402/exclude-grep-from-your-grepped-output-of-ps-alias-included-in-description | |
| alias chromekill="ps ux | grep '[C]hrome Helper --type=renderer' | grep -v extension-process | tr -s ' ' | cut -d ' ' -f2 | xargs kill" | |
| # Lock the screen (when going AFK) | |
| alias cya="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" | |
| # Reload the shell (i.e. invoke as a login shell) | |
| alias reload="exec $SHELL -l" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment