-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zsh_aliases
93 lines (90 loc) · 2.99 KB
/
.zsh_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
: "LIST"
alias ls='ls -F --color=auto'
alias list='ls -alF'
alias ll='ls -l'
alias la='ls -A'
alias lc='ls -CF'
function lf(){
#ls -1 $@ | xargs readlink -f
for i in $(/bin/ls -1)
do
echo ${PWD}/${i}
done
}
alias watch='watch -n0.5' # default 0.5sec.
: "Colorize"
alias tree='tree -NC' # -N for Japanese.
alias grep='grep --color=auto'
alias less='less -SR'
: "GREP DISPLAY"
alias grep-sharp="grep -v '^\s*#'"
alias grep-blank="grep -v '^\s*$'"
alias grep-semicol="grep -v '^\s*;'"
alias grep-slash="grep -v '^\s*\/'"
: "Network Shortcut"
alias inet4='ip a | grep -v inet6 | grep inet'
alias inet6='ip a | grep inet6'
alias inet='ip a | grep inet'
alias trec='npx terminalizer'
: "Shortcut"
alias vi='vim'
alias e='vim'
alias g='subl'
alias nb='newsboat'
alias of='libreoffice'
alias zsh-reload='source ~/.zshenv'
alias bye='loginctl lock-session'
alias ok='true'
alias ng='false'
alias tailfull="tail -n"$(($(tput lines) -2))
alias wgetmp='wget -P /tmp'
: "history"
alias hist='history'
alias histall='history-all'
alias history-all='history -E 1'
: "Line Display"
#alias nl='nl -w3 -nrz -s":| "'
: "ext. run-setting"
alias -s source="source" # .source ext. is using source command(keep on parent shell)
: "shell_alias"
alias watch-tailfull="${ZDOTDIR}/util.d/watch-tailfull.sh"
alias watch-tailfull-csv="${ZDOTDIR}/util.d/watch-tailfull-csv.sh"
: "Line Edit"
alias del-line-head-spaces="sed 's/^[ \t]*//'"
alias del-line-tail-spaces="sed -e 's/[ \t]*$//’"
alias del-all-spaces="sed 's/ //g’"
: "OtherTool"
function highlight(){
local reg="$(echo "$@" | sed -e 's;\ ;|;g' -e 's;^;(;g' -e 's;$;);g')"
cat /dev/stdin | grep -E "$reg|$"
}
alias ls-size='/usr/bin/find . -type f -exec ls -al {} \; | sort -k 5 -nr | less'
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$//'\'')"'
alias exit-zsh="exit 14"
alias relogin-zsh='exec $SHELL -l'
alias reload-zsh='exec $SHELL'
alias ta='tmux a -t'
alias tn='tmux new -s'
alias bash="export RUN_ZSH=1 ; /usr/bin/env bash"
alias newsboat='unset DISPLAY; newsboat'
function drop_caches(){
if [[ $# -ne 1 ]]
then
echo "usage: $0 [1|2|3|4]"
echo "Arg: (1) Drop PageCache (2) Drop Slab (3) PageCache and Slab (4) Toggle KERN_INFO"
return 1
fi
if [[ "$1" == "1" ]] || [[ "$1" == "2" ]] || [[ "$1" == "3" ]] || [[ "$1" == "4" ]]
then
echo "$1" | sudo tee /proc/sys/vm/drop_caches > /dev/null
else
echo "usage: $0 [1|2|3|4]"
echo "Arg: (1) Drop PageCache (2) Drop Slab (3) PageCache and Slab (4) Toggle KERN_INFO"
return 1
fi
}
function histgrep(){
history-all | grep "$@"
}
# export PATH here.
alias exportpathwd='export PATH="$PWD:$PATH"'