-
Notifications
You must be signed in to change notification settings - Fork 2
/
aliases
123 lines (102 loc) · 3.34 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
# Just some handy aliases for commands and functions
# NOTE: `dircolors` requires the coreutils package to be installed.
# Alternatively, you could use BSD's output:
# export CLICOLOR=1
# export LSCOLORS=exfxcxdxbxegedabagacad
#
# ..and use this instead on OS X
# alias ls='ls -G'
#
# Otherwise, remember to replace the following on Ubuntu:
# `gdircolors` => `dircolors`
# `gls` => `ls`
# Global Aliases
alias -g M='| most'
alias -g NUL="> /dev/null 2>&1"
alias -g S='| sort -n'
alias -g TL='| tail -f'
alias -g C='| wc -l'
alias -g AG='| ag'
alias -g PJ='| python -mjson.tool'
alias -g JQ='| jq .'
alias -g yml='| bat -l yaml -p'
# Double Rainbows!
[[ -f ~/.dircolors ]] && . ~/.dircolors || eval "$(dircolors -b)"
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
alias diff=colordiff
alias ls='gls --color=auto'
alias la='ls -AX'
alias ll='ls -lh'
alias ..='cd ..'
alias ...='cd ../..'
alias dv='dirs -v'
alias tag='ctags -R -f .git/tags'
alias rand='echo $RANDOM'
alias mkd='mkdir -pv'
alias more=most
alias lol=lolcat
alias today='cal | grep -E --color "\b$(date +%e)\b|$"'
alias du='du --max-depth=1 -h'
alias branches='git branch -a'
alias vim='nvim'
# Attach or create tmux session named the same as current directory.
function tat () {
tmux new-session -As "$(basename "$PWD" | tr . -)"
}
function tma () {
tmux -2 attach -t "$1"
}
function tmk () {
tmux kill-session -t "$1"
}
alias tml='tmux list-sessions'
alias dcu='docker compose up'
alias dcs='docker compose stop'
alias k='kubectl'
alias klog='kubectl logs -f'
alias kno='kubectl get no'
alias kpow='kubectl get po -w'
function kns () {
if [ -z "$1" ]; then
kubectl get ns -o custom-columns=':.metadata.name'
else
kubectl config set-context --current --namespace="$1"
fi
}
alias v='velero'
# Add an "alert" alias for long running commands. Use like so:
# sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
# Copy using rsync with the following options:
# @see: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/cp/cp.plugin.zsh
# -p - preserve permissions
# -o - preserve owner
# -g - preserve group
# -h - output in human-readable format
# --progress - display progress
# -b - instead of just overwriting an existing file, save the original
# --backup-dir=/tmp/rsync - move backup copies to "/tmp/rsync"
# -e /dev/null - only work on local files
# -- - everything after this is an argument, even if it looks like an option
alias cpv='rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --'
# File renaming with zmv function. Remember to add `autoload zmv` to your .zshrc
# Usage:
# mmv *.c.orig orig/*.c
# If you decide to ditch the 'noglob', remember to quote the parameters.
alias mmv='noglob zmv -vW'
alias zcp='zmv -C'
alias zln='zmv -L'
# housekeeping for homebrew
alias upd='brew upgrade && brew cleanup --prune 90'
alias wifi='networksetup -setairportpower en0'
alias myip='curl -sSL https://plex.tv/:/ip'
function procmem () {
ps -eo size,pid,user,command --sort -size | \
awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | \
cut -d "" -f2 | cut -d "-" -f1
}
#EOF