forked from alrra/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_aliases
132 lines (93 loc) · 4.78 KB
/
bash_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
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Lock screen.
alias afk="osascript -e 'tell application \"System Events\" to sleep'"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Google Chrome
if [ -x /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ]; then
# http://superuser.com/questions/187071/in-mac-os-x-how-often-is-tmp-deleted
alias chrome-insecure="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --user-data-dir=\"/tmp/chrome_insecure_session\" --allow-outdated-plugins --disable-web-security &"
fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Shorter commands for `Homebrew`.
alias brewb="brew bundle"
alias brewd="brew doctor"
alias brewo="brew outdated --greedy"
alias brewi="brew install"
alias brewr="brew uninstall"
alias brews="brew search"
alias brewl="brew list --full-name"
alias brewu="brew update --quiet \
&& brew upgrade \
&& brew-upgrade-casks \
&& brew cleanup"
alias brew-tap-list="brew tap"
alias brew-tap-details="brew tap-info --installed"
# https://gist.github.com/christopheranderton/9929502185dd0a6545c900cca0f5f614
alias brew-upgrade-casks='brew upgrade --cask $(brew outdated --cask --greedy --quiet)'
alias brew-upgrade-casks-testing="brew upgrade --cask --greedy"
# https://github.com/Homebrew/homebrew-bundle
# https://gist.github.com/ChristopherA/a579274536aab36ea9966f301ff14f3f
alias brew-bundle-write-dump='brew bundle dump --file=$HOME/.dotfiles/src/os/installs/macos/Brewfile --force'
alias brew-bundle-sync-system-with-dump='brew bundle --force cleanup'
alias brew-bundle-read-dump='brew bundle install --file=$HOME/.dotfiles/src/os/installs/macos/Brewfile'
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Shorter commands for `Mac App Store command line interface`.
# https://github.com/mas-cli/mas
# https://github.com/mas-cli/mas/tree/main/Sources/MasKit/Commands
alias maso="mas outdated"
alias masi="mas install"
alias masr="mas uninstall"
alias mass="mas search"
alias masl="mas list"
alias masu="mas upgrade"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Clear DNS cache.
alias clear-dns-cache="sudo dscacheutil -flushcache; \
sudo killall -HUP mDNSResponder"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Empty the trash, the main HDD and on all mounted volumes,
# and clear Apple’s system logs to improve shell startup speed.
#
# Use 'Console' to view Apple's system logs
# (https://crucialsecurityblog.harris.com/2011/08/24/the-apple-system-log-%E2%80%93-part-2-%E2%80%93-console-app/)
#
# Also, clear history of files downloaded. OS X actually keeps a record of this!!!!
# (See http://www.redmondpie.com/os-x-logs-every-file-you-download-heres-how-you-can-delete-it/)
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'"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# 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"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Get local IP.
alias local-ip="ipconfig getifaddr en0" # en0 is typically for ethernet and en1 is typically for wifi. Use ifconfig -a to find out interface name
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Open from the terminal.
alias o="open"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Update applications and command line tools (CLTs)
alias u="sudo softwareupdate --install --all \
&& brew update \
&& brew upgrade \
&& brew-upgrade-casks \
&& brew cleanup \
&& mas upgrade \
&& bash-it update \
&& upgrade-nvm \
&& npm install -g npm \
&& npm update -g \
&& upgrade-tpm \
&& install-update-tpm-plugins \
&& update-vim-plugins"