Skip to content

Commit 481790e

Browse files
committed
Tidy aliases
1 parent 8d3b4ba commit 481790e

File tree

1 file changed

+14
-27
lines changed

1 file changed

+14
-27
lines changed

dotfiles/.aliases

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ alias path='echo -e ${PATH//:/\\n}'
4242
# Get current month number
4343
alias month='date +%m'
4444

45-
# Get external IP address
46-
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
47-
48-
# Get internal IP address (depends on network interface, see `ifactive`)
49-
alias localip="ipconfig getifaddr en5"
50-
51-
# List all IPv4 and IPv6 addresses associated with all network interfaces on the system
52-
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
53-
54-
# Show active network interfaces
55-
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
56-
5745
# Run Rails tests with bundle exec
5846
alias bert="bundle exec rails test"
5947

@@ -98,39 +86,38 @@ alias flush="dscacheutil -flushcache && killall -HUP mDNSResponder"
9886
# Clean up LaunchServices to remove duplicates in the “Open With” menu
9987
alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
10088

101-
# Canonical hex dump; some systems have this symlinked
102-
command -v hd > /dev/null || alias hd="hexdump -C"
89+
# Get external IP address
90+
alias ip="dig +short myip.opendns.com @resolver1.opendns.com"
91+
92+
# Get internal IP address (depends on network interface, see `ifactive`)
93+
alias localip="ipconfig getifaddr en5"
10394

104-
# macOS has no `md5sum`, so use `md5` as a fallback
105-
command -v md5sum > /dev/null || alias md5sum="md5"
95+
# List all IPv4 and IPv6 addresses associated with all network interfaces on the system
96+
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
10697

107-
# macOS has no `sha1sum`, so use `shasum` as a fallback
108-
command -v sha1sum > /dev/null || alias sha1sum="shasum"
98+
# Show active network interfaces
99+
alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'"
109100

110101
# Trim new lines and copy to clipboard
111102
alias c="tr -d '\n' | pbcopy"
112103

113104
# Recursively delete `.DS_Store` files
114105
alias cleanup="find . -type f -name '*.DS_Store' -ls -delete"
115106

116-
# Empty the Trash on all mounted volumes and the main HDD.
117-
# Also, clear Apple’s System Logs to improve shell startup speed.
118-
# Finally, clear download history from quarantine. https://mths.be/bum
119-
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'"
120-
121107
# Show/hide hidden files in Finder
122-
alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
123-
alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
108+
alias showhidden="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
109+
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
124110

125-
# Hide/show all desktop icons (useful when presenting)
126-
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
111+
# Show/hide all desktop icons (useful when presenting)
127112
alias showdesktop="defaults write com.apple.finder CreateDesktop -bool true && killall Finder"
113+
alias hidedesktop="defaults write com.apple.finder CreateDesktop -bool false && killall Finder"
128114

129115
# Open random file in folder
130116
alias random-file="find . -type f | shuf | head -n1 | xargs -I {} open {}"
131117

132118
# Disable Spotlight
133119
alias spotoff="sudo mdutil -a -i off"
120+
134121
# Enable Spotlight
135122
alias spoton="sudo mdutil -a -i on"
136123

0 commit comments

Comments
 (0)