-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.aliases
202 lines (157 loc) · 6.29 KB
/
.aliases
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
#!/usr/bin/env bash
alias s='source ~/.bash_profile && tmux source-file ~/.tmux.conf && bind -f ~/.inputrc'
alias python='python3'
# Easier navigation: .., ..., ~ and -
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias dl='cd ~/Downloads'
alias dt='cd ~/Desktop'
alias tmux='tmux -2'
# programs
alias xcode='open -a Xcode'
alias safari='open -a safari'
alias firefox='open -a firefoxDeveloperEdition'
alias chrome='open -a google\ chrome'
alias chromium='open -a google\ chrome\ canary'
alias f='open -a Finder'
alias rg='rg --hidden --ignore-case'
alias ag="ag --path-to-ignore ~/.agignore"
alias la='eza -all --icons --git'
alias eza='eza -l --icons --git'
alias k5="kill -9 %%"
# List all files colorized in long format, including dot files
# alias la="ls -laF ${colorflag}"
# List only directories
# https://www.cyberciti.biz/faq/linux-list-just-directories-or-directory-names/
alias lsd='ls -ld */'
# List only hidden files
# https://askubuntu.com/questions/468901/how-to-show-only-hidden-files-in-terminal
alias lsh='ls -ld .?*'
#https://www.reddit.com/r/webdev/comments/4ridy1/most_used_commands_on_your_shell/
#alias mcmd ="cat ~/.zsh_history|cut -d \';\' -f 2- 2>/dev/null| awk \'{a[$1]++ } END{for(i in a){print a[i] " " i}}\'|sort -rn|head"
# Stopwatch
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
alias sleep="pmset sleepnow"
if [[ "$OSTYPE" =~ ^darwin ]]; then
alias ls="command ls -G"
# Hide/Show desktop icons
alias hide-desktop-icons='defaults write com.apple.finder CreateDesktop -bool false && killall Finder'
alias show-desktop-icons='defaults write com.apple.finder CreateDesktop -bool true && killall Finder'
# Hide/Show hidden files in Finder
alias hide-hidden-files='defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder'
alias show-hidden-files='defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder'
alias update='sudo softwareupdate --install --all \
&& brew update \
&& brew upgrade --all \
&& brew cleanup \
&& npm install -g npm \
&& npm update -g'
if command -v 'brew' &> /dev/null; then
alias brewd='brew doctor'
alias brewi='brew install'
alias brewr='brew uninstall'
alias brews='brew search'
alias brewu='brew update \
&& brew upgrade --all \
&& brew cleanup \
&& brew cask cleanup'
fi
elif [ "$OS" = 'ubuntu' ]; then
alias ls="command ls --color"
#Hide/Show desktop icons
alias hide-desktop-icons='gsettings set org.gnome.desktop.background show-desktop-icons false'
alias show-desktop-icons='gsettings set org.gnome.desktop.background show-desktop-icons true'
alias update='sudo apt-get update \
&& sudo apt-get upgrade \
&& npm install -g npm \
&& npm upgrade -g'
# Advanced Packaging Tool
alias apti='sudo apt-get install'
alias aptr='sudo apt-get remove'
alias apts='sudo apt-cache search'
alias aptu='sudo apt-get update \
&& sudo apt-get upgrade'
# Empty the trash, the main HDD and on all mounted volumes
# and clear Apple’s system logs to improve shell startup speed
alias empty-trash='sudo rm -frv /Volumes/*/.Trashes; \
sudo rm -frv ~/.Trash; \
sudo rm -frv /private/var/log/asl/*.asl; \
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* "delete from LSQuarantineEvent"'
fi
##### yarn #####
alias ys='yarn start'
alias yd='yarn dev'
##### npm #####
alias npmp='npm publish'
alias npma='npm adduser'
alias npmi='npm install'
alias npmg='npm install -g'
alias npmu='npm update'
alias npmr='npm uninstall'
alias npmrg='npm uninstall -g'
alias nom='rm -rf node_modules && npm cache clear && npm i'
alias nomm='rm -rf node_modules && yarn cache clear && yarn'
# npm offline
# install npm dependencies from cache
# https://github.com/npm/npm/issues/2568#issuecomment-30626394
alias npmo='sudo npm install --cache-min 999999999'
##### GIT Stuff #####
alias g="git"
alias gpom="git push origin master"
# git root
alias gr='[ ! -z `git rev-parse --show-cdup` ] && cd `git rev-parse --show-cdup || pwd`'
alias gv='v +GV +"autocmd BufWipeout <buffer> qall"'
##### GIT Stuff #####
# IP addresses
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="ipconfig getifaddr en1"
alias ips="ifconfig -a | perl -nle'/(\d+\.\d+\.\d+\.\d+)/ && print $1'"
# Enhanced WHOIS lookups
alias whois="whois -h whois-servers.net"
# Flush Directory Service cache and reset internet
alias flush="sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder && sudo ifconfig en0 down && sudo ifconfig en0 up"
# 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 \/.*\""
##### Vim ######
#alias vim=/usr/local/bin/vim
alias vi=$EDITOR
alias v='vi'
##### Vim ######
alias cp='cp -v'
alias rm='rm -v'
alias curl='curl -v'
alias chown='chown -v'
alias chmod='chmod -v'
# File size
alias fs="stat -f \"%z bytes\""
# get file permissions in octal (i.e. 0755)
alias perms="stat -f '%A %a %N' *"
# ROT13-encode text. Works for decoding, too! ;)
alias rot13='tr a-zA-Z n-za-mN-ZA-M'
####### Clean Up ########
# Recursively delete `.DS_Store` files
alias cleanup="find . -name '*.DS_Store' -type f -ls -delete"
alias rmf="rm -rf"
# Trim new lines and copy to clipboard
alias tt="tr -d '\n' | pbcopy"
# 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"
# One of @janmoesen’s ProTip™s
for method in GET HEAD POST PUT DELETE TRACE OPTIONS; do
alias "$method"="lwp-request -m '$method'"
done
# Make Grunt print stack traces by default
command -v grunt > /dev/null && alias grunt="grunt --stack"
# 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"