-
Notifications
You must be signed in to change notification settings - Fork 0
/
.aliases
92 lines (78 loc) · 4.52 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
# shellcheck disable=SC2139
# Allow aliases to be sudo'ed
alias sudo='sudo '
# Generic aliases
alias c='clear'
alias cat='bat'
alias console='tee -a ~/console.log'
alias cp='cp -i'
alias cwd='pwd | tr -d "\r\n" | pbcopy'
alias du='dust -n 30'
alias fd='fd -H'
alias finder='open -a Finder ./'
alias fzf="fzf --preview 'bat --color=always --style=numbers --line-range=:500 {}'"
alias grep='rg'
alias h='history'
alias la="eza -abghHl --group-directories-first"
alias less='less -R'
alias locale='locale -a | grep UTF-8'
alias lr='eza -T -L 5 --git-ignore'
alias lsd="eza -laDh"
alias mkdir='mkdir -pv'
alias mv='mv -i'
alias path='echo -e ${PATH//:/\\n}'
alias ping='command -v gping > /dev/null && gping || graphping'
alias ports='sudo lsof -i -P -n | rg LISTEN'
alias preview='open -a Preview'
alias ps='procs'
alias r='exec ${SHELL} -l'
alias search='fd '
alias tar='tar -cvf'
alias top='top -R -F -s 10 -o rsize'
alias untar='tar -xvf'
alias week='date +%V'
alias vim='nvim'
alias zap='rm -i'
# Quicker navigations
alias ~='cd ~'
alias ..='cd ../' # Go back 1 directory level
alias ...='cd ../../' # Go back 2 directory levels
alias .3='cd ../../../' # Go back 3 directory levels
alias .4='cd ../../../../' # Go back 4 directory levels
alias .5='cd ../../../../../' # Go back 5 directory levels
alias .6='cd ../../../../../../' # Go back 6 directory levels
# Recursively delete .DS_Store files
alias cleanupds="fd -g '*.DS_Store' . -x rm -v"
# Clean up LaunchServices to remove duplicates in the “Open With” menu
alias cleanupls="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder"
# Empty the trash on all mounted volumes and the main HDD
# Also, clear Apple’s System Logs to improve shell startup speed
alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; speedup; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'"
# Speed-up Terminal load time by clearing system logs
alias speedup='sudo rm -rf /private/var/log/asl/*'
# Upgrade `Homebrew` packages
alias brewupdate='brew update && brew upgrade && brew cleanup; brew cu --all && brew cu --cleanup && brew doctor'
# Get macOS software update
alias update='sudo softwareupdate -i -a'
# Pipe public & private keys to the clipboard
alias pubkey="pbcopy < ~/.ssh/id_rsa.pub | echo '=> Public key copied to clipboard.'"
alias prikey="pbcopy < ~/.ssh/id_rsa | echo '=> Private key copied to clipboard.'"
# Networking
alias flushdns='sudo dscacheutil -flushcache && killall -HUP mDNSResponder' # flushDNS: Flush out the DNS Cache
alias ipInfo0='ipconfig getpacket en0' # ipInfo0: Get info on connections for en0
alias ipInfo1='ipconfig getpacket en1' # ipInfo1: Get info on connections for en1
alias localip='ipconfig getifaddr en0' # localip: Display the local address
alias lsock='sudo /usr/sbin/lsof -i -P' # lsock: Display open sockets
alias lsockT='sudo /usr/sbin/lsof -nP | grep TCP' # lsockT: Display only open TCP sockets
alias lsockU='sudo /usr/sbin/lsof -nP | grep UDP' # lsockU: Display only open UDP sockets
alias netCons='lsof -i' # netCons: Show all open TCP/IP sockets
alias nic="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'" # nic: Show active network interfaces
alias op='sudo lsof -i -P' # op: List of open ports
alias openports='sudo lsof -i | rg LISTEN' # openPorts: All listening connections
alias pubip='curl -s checkip.dyndns.org | sed -e "s/.*Current IP Address: //" -e "s/<.*$//"' # myip: Public facing IP Address
# View HTTP traffic
alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\""
alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'"
# Lock the screen when away from keyboard
alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend"