-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.aliases
92 lines (72 loc) · 2.89 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
#!/usr/bin/env bash
if [[ $DISTRO == "macos" ]]; then
# Shortcuts
alias dl="cd ~/Downloads"
alias dt="cd ~/Desktop"
alias repos="~/Code"
# Chrome with debugging port
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222"
alias localip="ipconfig getifaddr en0"
# Show active network interfaces
alias ifactive="ifconfig | pcregrep --multiline --only-matching '^[^\t:]+:([^\n]|\n\t)*status: active'"
# 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.
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'"
# http://xkcd.com/530/
alias stfu="osascript -e 'set volume output muted true'"
alias pumpitup="osascript -e 'set volume output volume 100'"
fi
# Use eza as ls and tree
if command -v eza &>/dev/null; then
alias ls="eza --classify --git --icons"
alias tree="eza --tree --git --icons"
alias la="ll"
alias l="ls -1"
fi
# Use tldr as man
if command -v tldr &>/dev/null; then
alias man="tldr"
fi
# Get week number
if command -v date &>/dev/null; then
alias week='date +%V'
fi
# IP addresses
if command -v dig &>/dev/null; then
alias myip="dig TXT +short o-o.myaddr.l.google.com @ns1.google.com -4 && dig TXT +short o-o.myaddr.l.google.com @ns1.google.com -6"
fi
# Canonical hex dump; some systems have this symlinked
command -v hd > /dev/null || alias hd="hexdump -C"
# macOS has no `md5sum`, so use `md5` as a fallback
command -v md5sum > /dev/null || alias md5sum="md5"
# macOS has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"
# Trim new lines and copy to clipboard
alias c="tr -d '\n' | pbcopy"
# URL-encode strings
if command -v python3 &>/dev/null; then
alias urlencode='python3 -c "import sys, urllib, urllib.parse; print(urllib.parse.quote_plus(sys.argv[1]));"'
elif command -v python &>/dev/null; then
alias urlencode='python -c "import sys, urllib, urllib.parse; print(urllib.parse.quote_plus(sys.argv[1]));"'
fi
# Intuitive map function
# For example, to list all directories that contain a certain file:
# find . -name .gitattributes | map dirname
alias map="xargs -n 1"
# Reload the shell (i.e. invoke as a login shell)
alias reload='exec ${SHELL} -l'
# Print each PATH entry on a separate line
alias path='echo -e ${PATH//:/\\n}'
# Fall back to diff if diff-so-fancy is not available
if ! command -v diff-so-fancy &>/dev/null; then
alias diff-so-fancy="diff"
fi
# Alias bat to batcat
if command -v batcat &>/dev/null; then
alias bat="batcat"
fi
# Alias docker-compose to docker compose
if command -v docker &>/dev/null; then
alias docker-compose="docker compose"
fi