aboutsummaryrefslogtreecommitdiffstats
path: root/.zsh.after/aliases.zsh
blob: be1236751cf1312cf52188be56f34fe21dda5797 (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# < ZSH ALIASES
## EXTENSIONS
alias -s pdf='mupdf'
alias -s ps='mupdf'
alias -s jpg='feh'
alias -s png='feh'
alias -s gif='viewnior'
alias -s gz='tar xvfz'
alias -s tgz='tar xvfz'
alias -s bz2='tar xvfj'
alias -s tbz='tar xvfj'
alias -s tlz='tar --lzma -xvf'
alias -s rar='unrar x'
alias -s tex='mkpdf'

##LS
alias ls='ls --group-directories-first --color=auto'
alias ll="ls -lh"
alias la="ls -a"
alias lal="ls -alhv"
alias lt='ls -tr'
alias ll='ls -l'
alias llh='ls -lh'
alias llt='ls -ltr'
alias la='ls -A'
alias lla='ls -lA'
alias lsfw='ls -lah /dev|grep fw'
alias lsvid='ls -lah /dev|grep video'

#zsh

# Lists the ten most used commands.
alias history-stat="history 0 | awk '{print \$2}' | sort | uniq -c | sort -n -r | head"

alias d='dirs -v'
for index ({1..9}) alias "$index"="cd +${index}"; unset index

#MPLAYER
alias mplayer='mplayer -ao jack,pulse,alsa'
if pgrep Xwayland > /dev/null; then
  alias mpv='mpv --audio-channels=stereo --gpu-context=wayland -ao jack,pulse,alsa --sub-auto=fuzzy'
else
  alias mpv='mpv --audio-channels=stereo -ao jack,pulse,alsa --sub-auto=fuzzy'
fi
if [[ "$VENDOR" == "apple" ]]; then
  alias mpv='mpv --sub-auto=fuzzy'
fi
##DU
alias du1='du -hd1'

##FEH
alias feh='feh -Z -g 1920x1200 -b "black" -S "filename"'

##GIT
alias gsi='git submodule update --init --recursive'
alias gsu='git submodule update --recursive'

##TREE
alias tree='tree -aC'
#grep aliases (with excluded directories)
alias grepdot='grep -rI --exclude-dir=".steam" --exclude-dir=".local" --exclude-dir=".thunderbird" --exclude-dir=".mozilla" --exclude-dir="git" --exclude-dir=".rvm" --exclude-dir=".log" --exclude-dir=".dropbox-dist" --exclude-dir=".config" '


##SYSTEMD
#tree
alias psc='ps xawf -eo pid,user,cgroup,args'
alias treeg='tree -d /cgroup/systemd/'
alias sdptree='tree -aC /usr/lib/systemd/'
alias sdstree='tree -aC /etc/systemd/'
alias sdutree='tree -aC $HOME/.config/systemd/'
#journalctl
alias sdsj='sudo journalctl --system -a' #show the entire system journal
alias sdsjf='sudo journalctl --system -af' #follow all system messages
alias sdsjb='sudo journalctl --system -ab' #Show system messages from specific boot
alias sdsjbf='sudo journalctl --system -ab -f' #follow only messages from this boot
alias sdsju='sudo journalctl --system -af -u' #follow messages of only the specified unit
alias sdsjk='journalctl -k' #show dmesg
alias sdsjkb='journalctl -kb' #show dmesg from specific boot
alias sdsjkf='journalctl -kf' #follow current dmesg
alias sdsjlb='journalctl --list-boots' #list all boots
alias sdsjp='sudo journalctl --system _PID='  #show all messages of specified system process (PID)
alias sdjgrep='sudo journalctl -an1000 |grep ' #Use a grep command to search through journal
alias sduj='journalctl --user -a'
alias sdujf='journalctl --user -af'
alias sdujb='journalctl --user -ab'
alias sdujbf='journalctl --user -afb'
alias sdujb='journalctl --user -ab'
alias sdujp='journalctl --user _PID='  #show all messages of specified user process (PID)
#systemd system services
alias sdsstart='sudo systemctl start'
alias sdsstop='sudo systemctl stop'
alias sdsrestart='sudo systemctl restart'
alias sdsreload='sudo systemctl reload'
alias sdsenable='sudo systemctl enable'
alias sdsdisable='sudo systemctl disable'
alias sdsreenable='sudo systemctl reenable'
alias sdsisactive='sudo systemctl is-active'
alias sdsisenabled='sudo systemctl is-enabled'
alias sdsstat='sudo systemctl status -a -l'
alias sdswants='sudo systemctl show -p "Wants"'
alias sdswantedby='sudo systemctl show -p "WantedBy"'
alias sdsrequires='sudo systemctl show -p "Requires"'
alias sdsrequiredby='sudo systemctl show -p "RequiredBy"'
alias sdsconflicts='sudo systemctl show -p "Conflicts"'
alias sdsconflictedby='sudo systemctl show -p "ConflictedBy"'
alias sdsbefore='sudo systemctl show -p "Before"'
alias sdsafter='sudo systemctl show -p "After"'
alias sdst='sudo systemctl --system list-timers'
alias sdss='sudo systemctl --system list-sockets'
alias sdsu='sudo systemctl --system list-units'
alias sdsuf='sudo systemctl --system list-unit-files'
alias sdsdep='sudo systemctl --system list-dependencies'
alias sdscat='sudo systemctl --system cat'
alias sdsreload='sudo systemctl daemon-reload'
alias sds='sudo systemctl -a'
alias sdsfail='sudo systemctl -a -l --no-legend --state=failed'
alias sdsmask='sudo systemctl mask'
alias sdsunmask='sudo systemctl unmask'
#systemd user services
alias sdustart='systemctl --user start'
alias sdustop='systemctl --user stop'
alias sdurestart='systemctl --user restart'
alias sdureload='systemctl --user reload'
alias sduenable='systemctl --user enable'
alias sdudisable='systemctl --user disable'
alias sdureenable='systemctl --user reenable'
alias sduisactive='systemctl --user is-active'
alias sduisenabled='systemctl --user is-enabled'
alias sdustat='systemctl --user status -a -l'
alias sduwants='systemctl --user show -p "Wants"'
alias sduwantedby='systemctl --user show -p "WantedBy"'
alias sdurequires='systemctl --user show -p "Requires"'
alias sdurequiredby='systemctl --user show -p "RequiredBy"'
alias sduconflicts='systemctl --user show -p "Conflicts"'
alias sduconflictedby='systemctl --user show -p "ConflictedBy"'
alias sdubefore='systemctl --user show -p "Before"'
alias sduafter='systemctl --user show -p "After"'
alias sdut='systemctl --user list-timers'
alias sdus='systemctl --user list-sockets'
alias sduu='systemctl --user list-units'
alias sdudep='systemctl --user list-dependencies'
alias sducat='systemctl --user cat'
alias sdureload='systemctl --user daemon-reload'
#alias sdu='systemctl --user'
alias sdufail='systemctl --user -a -l --no-legend --state=failed'
alias sdumask='systemctl --user mask'
alias sduunmask='systemctl --user unmask'
#poweroff/reboot/isolate
alias sdiso='sudo systemctl isolate '
alias sdreboot='sudo systemctl reboot'
alias sdpoweroff='sudo systemctl poweroff'
alias sdsuspend='sudo systemctl suspend'
#systemd bootchart
alias sda='systemd-analyze'
alias sdab='systemd-analyze blame'
if [ -x /usr/bin/xsvg ]; then
  alias sdap='xsvg $HOME/cloud/photos/systemd/sdap-$HOST.svg'
fi

##PACMAN
alias paclid="sudo pacman -Qi | sed '/^Depends On/,/^Required By/{ s/^Required By.*$//; H; d }; /^Name/!d; /^Name/{ n;x;}'| sed '/^$/s//==================================================================================/'"
alias pacsize="pacman -Qi | awk '/^Name/ {pkg=\$3} /Size/ {print \$4\$5,pkg}' | sort -n"  #Show all packages by size
alias pacall="sudo pacman -Qi | awk '/^Name/ {pkg=\$3} /Version/ {ver=\$3} /Size/ {size=\$4\$5} {print pkg,ver,size}' | uniq"  #All packages uniquely with name, version, size
alias pacup='sudo pacman -Syu'  #Synchronize with repositories before upgrading packages that are out of date on the local system.
alias pac='sudo pacman -S'  #Install specific package(s) from the repositories
alias pacu='sudo pacman -U'  #Install specific package not from the repositories but from a file 
alias pacre='sudo pacman -R'  #Remove the specified package(s), retaining its configuration(s) and required dependencies
alias pacrem='sudo pacman -Rns'  #Remove specified package(s), its configuration(s) and unneeded depends
alias pacname="sudo pacman -Qi|grep Name|grep "  #Search through names of packages by string
alias pacri='pacman -Si'  #Display information about a given package in the repositories
alias pacrs='pacman -Ss'  #Search for package(s) in the repositories
alias pacli='pacman -Qi'  #Display information about a given package in the local database
alias pacls='pacman -Qs'  #Search for package(s) in the local database
alias pacorph='sudo pacman -Qdt'  #Search for orphan packages
alias paclal='sudo pacman -Ql'  #List installed files of a given package
alias pacg='pacman -Sg'  #List all groups or all packages in specified group
alias pacclean='sudo pacman -Sc'  #Remove all packages from local repository, not installed atm, remove all unused repos
alias pacconf='sudo find /etc -type f \( -name "*.pacsave" -o -name "*.pacnew" \)'  #Search for .pacnew and .pacsave files
alias pacown='sudo pacman -Qo'  # Find out what package a give file belongs to
alias pacupd='sudo pacman -Sy && sudo abs'  #Update and refresh the local package and ABS databases against repositories
alias pacdep='sudo pacman -S --asdeps'  #Install given package(s) as dependencies of another package
alias pacmir='sudo pacman -Syy'  #Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
alias packup='comm -23 <(pacman -Qeq|sort) <(pacman -Qmq|sort) > $HOME/Dropbox/sync/archlinux/pkglist-$HOST'  #Backup the current list of non-local packages
alias pacret='sudo pacman -S $(< $HOME/Dropbox/sync/archlinux/pkglist-$HOST)'  #Install from the backup list
alias pacredown='sudo pacman -S $(comm -23 <(pacman -Qeq) <(pacman -Qmq))'  #Redownload all installed packages (minus AUR)
alias pacdis='sudo pacman-disowned > /tmp/$USERNAME/non-pkg-$HOST'  #Getting a list of files not owned by any package
alias packimp='sudo pacman-key -r '  #Import a key ID to the pacman keyring
alias packsign='sudo pacman-key --lsign-key '  #Sign a key ID after importing it to the keyring
alias packref='sudo pacman-key --refresh-keys'  #Refresh the list of master keys

##YAOURT
alias yaup='yaourt -Syu --devel --aur'  #Updates all locally installed repository, AUR and git packages
alias yadb='yaourt -B $HOME/ownCloud/backup/settings/'  #Backs up the yaourt database

##XCLIP
alias cpx="xclip -selection clipboard -display :0"

##CD
alias cd.sds="cd /etc/systemd/system"
alias cd.sdp="cd /usr/lib/systemd/system"
alias cd.courses="cd $HOME/ownCloud/documents/university/tu-berlin/courses"
alias cd.backup="cd $HOME/ownCloud/backup"
alias cd.scpref="cd $HOME/.config/SuperCollider"

##OCTAVE
#alias octave="octave --silent --braindead --force-gui"
alias octave="octave --force-gui"

##MATLAB
alias matlabc="matlab -nodesktop -nosplash"

##NMCLI
alias nmup="sudo nmcli con up id"
alias nmdown="sudo nmcli con down id"
alias nmstat="sudo nmcli con show --active"
alias nmlist="sudo nmcli con list"
alias nmdev="sudo nmcli dev"

#SSH
alias ssh.add="ssh-add $HOME/.ssh/id_{rsa{,_tu},ed25519{,_aur,_github,_holoplot}}"
alias ssh.new='ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)-$(date -I)"'
if [ $VENDOR = "apple" ]; then
  # apple's date is broken
  alias ssh.new='ssh-keygen -t ed25519 -C "$(whoami)@$(hostname)-$(date +%Y-%m-%d)"'
fi
alias pool='ssh pool -Y'
alias sshtunnel="ssh -ND 44350 -v -p 46399 dave@frqb.zapto.org" # tunnel through home
alias frqtun="ssh -ND 44350 -v frq"
alias scp=scp

#KEYCHAIN
alias keyflush="keychain --clear && keychain -k mine"

#PULSEAUDIO
alias pak='pulseaudio --kill'
alias pas='pulseaudio --start'
alias paflush='pax11publish -r'
alias bthp="pactl load-module module-bluetooth-device address='00:1B:66:01:6C:D1'"  #load bluetooth headphone module for pulseaudio

#PYTHON
alias pyserv='python -m http.server' # start a python http server

# VDIRSYNCER
alias vsync="vdirsyncer sync"

#WOL
alias woldave_in='wol -i homey 00:15:f2:e0:e0:c6'  #wake up homey
alias woldave_ex='wol -p X -i frqb.zapto.org 00:15:f2:e0:e0:c6'  #wake up homey via

## OVERRIDES
# Colorize grep output
alias grep='grep --color=auto --exclude-dir=.git'
alias psgrep='ps aux | grep -v "grep"| grep $1'
alias greptodo='grep -R "TODO" .'
alias exit="clear; exit"
alias du='du -h'
alias .='source'


## HELP
alias helpdd='echo dd if=bla | pv -s 10M | dd of=blob'

# ZSH ALIASES >