-
Notifications
You must be signed in to change notification settings - Fork 2
/
.aliases
105 lines (83 loc) · 2.55 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
#!/bin/zsh
# Platform-specific aliases
PLATFORM=`uname`
if [[ "$PLATFORM" == 'Linux' ]]; then
alias ls='ls --color=auto -h'
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
alias open='xdg-open'
alias dus='du -hxd 1 | sort -h'
elif [[ "$PLATFORM" == 'FreeBSD' ]]; then
alias ls='ls -Gh'
elif [[ "$PLATFORM" == 'Darwin' ]]; then
alias ls='ls -Gh'
alias dus='du -hd 1 | gsort -h'
fi
# OpenSSL
alias sha1='openssl sha1'
alias md5='openssl md5'
# Use mkdir's automatic parent creation mode
alias mkdir='mkdir -pv'
# Always run rsync/wget in verbose/partial mode with retry enabled
alias wget='wget -c'
alias rsync='rsync --progress --partial'
# Always run df/du with human-readable output
alias df='df -h'
alias du='du -h'
# Some rlwrap aliases for REPLs that don't support readline
alias ocaml='rlwrap ocaml'
alias v8='rlwrap v8'
alias d8='rlwrap d8'
alias coffee='rlwrap coffee'
# Run pacman with color output
alias pacman='pacman --color auto'
# Run ip with color output
alias ip='ip --color'
# Run tmux in 256-color mode
alias tmux='tmux -2'
# Some ls aliases
alias ll='ls -lh'
alias lrt='ls -lrth'
alias la='ls -lha'
# Cuts selected columns in multi-space commands (e.g. ps)
alias fcut="tr -s ' ' | cut -d ' ' -f"
# Sums integers
# http://stackoverflow.com/questions/450799
alias fsum="awk '{s+=\$1} END {print s}'"
# Human-readable numbers
# http://unix.stackexchange.com/questions/44040
alias fhum="numfmt --to=iec-i --padding=7"
# Kills the last suspended job group
alias killit='kill -9 %%'
# Runs a command under GDB immediately
alias gdbrun='gdb -ex=r --args'
# Short format version of the current date or date/time
alias dt='date +%Y%m%d'
alias dtu='date +%Y-%m-%d'
alias dtt='date +%Y%m%d_%H%M%S'
# More powerful alias for strace
alias strace="strace -frttTyy"
# CSV to Excel conversion
alias csv2xls="soffice --convert-to xls"
# Convert a binary file to a PGM image
function bin2pgm() {
echo "P5 512 4096 255"
cat "$1"
}
# Count number of files in directory
function dn() {
for f; do
count=$(ls -Ub1 "$f" | wc -l)
echo "$count\t$f"
done
}
# SHA265 fingerprint of a TLS host, Base64-encoded
function tls_remote_sha256_b64() {
openssl s_client -connect "$1" < /dev/null 2>/dev/null |\
openssl x509 -noout -in /dev/stdin -pubkey |\
openssl pkey -pubin -outform der |\
openssl dgst -sha256 -binary |\
openssl enc -base64
}
# Reload Gnome-Shell extensions
alias reloadext="gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Extensions.ReloadExtension"