aboutsummaryrefslogtreecommitdiffstats
path: root/conf/aliases
blob: 960f4c1a8f26e5b01d796aea33da47fa6627a645 (plain)
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# included from ~/.bashrc or ~/.zshrc
################################################################################
# Here some of my current aliases, reviewed by blackmoor
# Have fun !
################################################################################
# feel free to take all or any part and modify as you want
# no real code here, just quick declaration, do what you want with it

################################################################################
# Programmation aliases
alias py3=ipython3
alias py2=ipython2
alias py=py3

################################################################################
# HTML documentation aliases
alias w3m-py2='w3m /usr/share/doc/python/html/index.html'
alias w3m-py3='w3m /usr/share/doc/python3/html/index.html'
alias w3m-py=w3m-py3
alias w3m-make='w3m /usr/share/doc/make-doc/make.html/index.html'
alias w3m-mutt='w3m /usr/share/doc/mutt/html/index.html'
alias w3m-i3='w3m /usr/share/doc/i3-wm/userguide.html'

################################################################################
# Debug aliases
alias diff='colordiff'
alias strace='strace -y -yy'

################################################################################
# Admin aliases
alias rm='rm -I --preserve-root'
#alias rm='rm --verbose' # when removing big directories, it's horrible
alias chown='chown --preserve-root'
alias chmod='chmod --preserve-root'
alias chgrp='chgrp --preserve-root'
mount() { /bin/mount "$@" | column -t; }
alias fumount='fusermount -u'
alias dmesg='sudo dmesg'
alias df='df -h'
alias du='du -ch'
alias top='htop'
alias ping='ping -c 5'
alias ping4='ping4 -c 5'
alias ping6='ping6 -c 5'
alias ping-fast='ping -c 100 -s.2'
alias sudo='sudo ' # allows to expand aliases before getting to sudo
alias alias-edit='e ~/.config/shell/aliases && alias-reload'
alias alias-reload='. ~/.config/shell/aliases'
alias i3-edit='e ~/.config/i3/config && i3-msg reload'

################################################################################
# Packages Manager aliases
apt() {
    if test "$1" = "search" -o "$1" = "show"; then
        /usr/bin/apt "$@"
    else
        /usr/bin/sudo /usr/bin/apt "$@"
    fi
}
alias apt-get='sudo apt-get'
dpkg-s-which() { dpkg -S $(which "$1"); }
alias p-upgrade='sudo apt-get update && sudo apt-get upgrade'
alias p-update='sudo apt-get update'
alias p-install='sudo apt-get install'
alias p-purge='sudo apt-get purge'
alias p-autopurge='sudo apt-get autoremove --purge'
alias p-show='apt-cache show'
alias p-search='apt-cache search'
# when I want to see manually installed packages to check if I forget nothing
# in my package list (I do it only in interactive shell):
alias apt-manually="comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)"
alias p-manually='apt-manually'
alias update='sudo apt update'
alias upgrade='sudo apt upgrade'
alias dist-upgrade='sudo apt dist-upgrade'
alias upup="update && dist-upgrade"

################################################################################
# Vocabulary search spell aliases
grep-dict() { cd /usr/share/dict; grep -ri "$@"; }
grep-dictfr() { cd /usr/share/dict; grep -i "$@" french; }
grep-dicten() { cd /usr/share/dict; grep -i "$@" american-english; }

################################################################################
# Current usage
rg() { if [[ -z "$RANGER_LEVEL" ]]; then \ranger "$@"; else exit; fi; }
alias ranger='rg'
function ranger-cd()
{
    ranger --choosedir=/tmp/chosen
    if [ -f /tmp/chosen -a "$(cat /tmp/chosen)" != "$(pwd | tr -d "\n")" ];
    then
        cd "$(cat /tmp/chosen)"
    fi
    rm -f /tmp/chosen
}
alias wget='wget -c'
alias wget+c='wget --no-continue'
# history
alias historytopten="history|awk '{a[\$4]++ } END{for(i in a){print a[i] \" \" i}}'|sort -rn|head"
function mkdircd() { mkdir -p "$@" && eval cd "\"\$$#\""; }

################################################################################
# cd aliases (no I'm not crasy, I've just some very deep folder)
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias ..1="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias ..6="cd ../../../../../.."
alias ..7="cd ../../../../../../.."
alias ..8="cd ../../../../../../../.."
alias ..9="cd ../../../../../../../../.."

################################################################################
# path and datetime
alias path='echo -e ${PATH//:/\\n}'
alias now='date +"%T"'
alias nowtime=now
alias nowdate='date +"%d-%m-%Y"'
alias datef="date +%F"

################################################################################
# editing/opening files
# ge = graphic edit, te = new term edit
alias ge="gvim"
alias e="vim"
alias o="xdg-open"
# td: quick clean test/temp dir, then inside remove it with rm -r $PWD
alias td='cd "$(mktemp -d -p ~/temp/)"'

################################################################################
# term/shell edit
alias t="term"
alias te="term vim"
alias termtitle="printf '\033]0;%s\007'"
alias xtermtitle="termtitle"
alias setxtermtitle="termtitle"
titleprefix() { TITLEPREFIX="$* "; }

################################################################################
# vcsh (special git repositories)
alias conf='vcsh conf'
alias git-status-conf='vcsh run conf git status'
alias git-status-gtk='vcsh run gtk git status'

################################################################################
# pim
alias m="mutt"
alias mu="mutt -y -Z || mutt -y"
# for sending mails from command-line I require to have a profile set
alias m-profile-vg="mutt -e 'set from=vg@devys.org'"

################################################################################
# power management
alias halt="sudo halt"
alias poweroff="sudo poweroff"
alias reboot="sudo reboot"
alias pm-suspend="sudo pm-suspend"
alias pm-hibernate="sudo pm-hibernate"
alias pm-hybrid="sudo pm-suspend"

################################################################################
# browser aliases
alias b="fx"
b_translate_enfr() { fx "http://www.wordreference.com/enfr/$1"; }
b_translate_fren() { fx "http://www.wordreference.com/fren/$1"; }
alias b-translate="b_translate_enfr"
alias b-translate-enfr="b_translate_enfr"
alias b-translate-fren="b_translate_fren"
b_define_en() { fx "http://en.wiktionary.org/wiki/$1"; }
b_define_fr() { fx "http://fr.wiktionary.org/wiki/$1"; }
alias b-define-en="b_define_en"
alias b-define-fr="b_define_fr"
alias b-define="b-define-en"
b_wiki_fr() { fx "http://en.wikipedia.org/wiki/$1"; }
b_wiki_en() { fx "http://fr.wikipedia.org/wiki/$1"; }
alias b-wiki-en="b_wiki_en"
alias b-wiki-fr="b_wiki_fr"
alias b-wiki="b-wiki-en"

# vim: set ft=sh et sts=4 sw=4 ts=4 :