-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.aliases
150 lines (125 loc) · 3.69 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
### navigation
#alias l='ls -F'
#alias ll='ls -l'
#alias la='ls -A'
alias lla='la -lA'
# list
if command -v eza 2>&1 >/dev/null; then
# eza is our friend :)
# check if eza has been compiled with certain support and use it if so
ezaargs="-hlg --time-style long-iso -F"
if eza --octal-permissions > /dev/null 2>&1; then
ezaargs="$ezaargs --octal-permissions"
fi
if eza --git > /dev/null 2>&1; then
ezaargs="$ezaargs --git"
fi
if eza --icons > /dev/null 2>&1; then
ezaargs="$ezaargs --icons"
fi
alias ls="eza $ezaargs"
alias l='ls'
alias la='ls -a'
alias lla='la'
alias lt='ls --tree'
alias lat='la --tree'
else
# fallback to normal ls
alias l='ls'
fi
# use neovim if installed
if command -v nvim 2>&1 >/dev/null; then
alias vim='nvim'
fi
if command -v duf 2>&1 >/dev/null; then
alias duf='duf --hide special'
fi
alias cd..="cd .."
alias ...="../.."
alias ....="../../.."
alias .....="../../../.."
alias ......="../../../../.."
alias .......="../../../../../.."
alias ........="../../../../../../.."
alias -- -="cd -"
### commands
alias -- +x='chmod +x'
alias -- -x='chmod -x'
alias f='free -m'
alias ff='df -h'
alias d='df -h'
alias h='htop'
#alias i='iotop'
alias n='nload'
alias wtf='sudo dmesg | tail -n 15'
alias wget-mirror='wget -m -np -p -k'
alias rsync-copy='rsync -avP'
if command -v fdfind 2>&1 >/dev/null; then
alias fd=fdfind
fi
# use bat for pretty cat
if command -v bat 2>&1 >/dev/null; then
alias cat='bat -pp'
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
fi
alias ssh-insecure='ssh -o StrictHostKeyChecking=no'
alias scp-insecure='scp -o StrictHostKeyChecking=no'
# inspired by https://github.com/jessfraz/dotfiles/
# Check for various OS openers. Quit as soon as we find one that works.
for opener in browser-exec xdg-open cmd.exe cygstart "start" open; do
if command -v $opener >/dev/null 2>&1; then
if [[ "$opener" == "cmd.exe" ]]; then
# shellcheck disable=SC2139
alias open="$opener /c start";
else
# shellcheck disable=SC2139
alias open="$opener";
fi
break;
fi
done
# Linux specific aliases, work on both MacOS and Linux.
pbcopy() {
stdin=$(</dev/stdin);
pbcopy="$(which pbcopy)";
if [[ -f "$pbcopy" ]]; then
echo "$stdin" | "$pbcopy"
else
echo "$stdin" | xclip -selection clipboard
fi
}
pbpaste() {
pbpaste="$(which pbpaste)";
if [[ -f "$pbpaste" ]]; then
"$pbpaste"
else
xclip -selection clipboard
fi
}
# Get week number
alias week='date +%V'
alias kw=week
# Stopwatch
#alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
# IP addresses
alias pubip="dig +short myip.opendns.com @resolver1.opendns.com"
alias localip="sudo ifconfig | grep -Eo 'inet (addr:)?([0-9]*\\.){3}[0-9]*' | grep -Eo '([0-9]*\\.){3}[0-9]*' | grep -v '127.0.0.1'"
alias ips="sudo ifconfig -a | grep -o 'inet6\\? \\(addr:\\)\\?\\s\\?\\(\\(\\([0-9]\\+\\.\\)\\{3\\}[0-9]\\+\\)\\|[a-fA-F0-9:]\\+\\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
# Trim new lines and copy to clipboard
#alias c="tr -d '\\n' | xclip -selection clipboard"
# copy to clipboard
alias c="xclip -selection clipboard"
# copy working directory
alias cwd='pwd | tr -d "\r\n" | xclip -selection clipboard'
# copy file interactive
alias cp='cp -i'
# move file interactive
alias mv='mv -i'
# untar
alias untar='tar xvf'
# Pipe my public key to my clipboard.
#alias pubkey="more ~/.ssh/id_ed25519.pub | xclip -selection clipboard | echo '=> Public key copied to pasteboard.'"
alias pubkey="more ~/.ssh/id_rsa.pub"
# Pipe my private key to my clipboard.
#alias privkey="more ~/.ssh/id_ed25519 | xclip -selection clipboard | echo '=> Private key copied to pasteboard.'"
alias privkey="more ~/.ssh/id_rsa"