myshellconfig/aliases
2021-05-06 01:05:53 +02:00

205 lines
10 KiB
Text

#Persönliche Aliases
# usefull commands
#alias fuck='f() { cmd=$1; shift; cmd=$(alias $cmd); echo sudo $cmd $@; }; f $(history -p \!\!)'
alias fuck='sudo $(history -p \!\!)'
alias wosis='which $(history -p \!\!)'
alias fix='reset; stty sane; tput rs1; clear; echo -e "\033c"' # Fix terminal aber binary output
# Source https://www.digitalocean.com/community/tutorials/how-to-use-bash-history-commands-and-expansions-on-a-linux-vps
alias vilastcatfile='vim $(history -p \!cat:$:t)'
alias vio='vim $(history -p \!less:$:t)'
alias viless='vim $(history -p \!less:$:t)'
alias cdlastfiledir='cd $(history -p \!\!:$:h)'
#alias ssh='function f() { trap "reset; stty sane; tput rs1; clear; echo -e \"\033c\"" EXIT ; ssh $@; }; f $@'
alias s='sshs $(history -p \!ssh:$:t)'
alias sexit='ssh -O exit $(history -p \!ssh:$:t)'
alias remountshared='sudo systemctl restart media-remote-sharefs-userdata.mount'
# paketmanagement
# -- apt
alias aptupgrade='sudo /usr/bin/apt update && sudo /usr/bin/apt dist-upgrade'
alias apt-get-key='sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys'
# -- dnf
alias dnfupgrade='sudo dnf upgrade --refresh'
# docker and docker-compose
alias dcdown='docker-compose down'
alias dclogs='docker-compose logs -f'
alias dcup='docker-compose up --build -d'
alias dcpull='docker-compose pull'
alias dcbuild='docker-compose build --pull'
alias dcrestartcollabora='docker-compose restart collabora-code'
alias dcrestart='docker-compose down && docker-compose pull && docker-compose up --build -d'
alias diclean='docker images | grep '\''<none>'\'' | grep -P '\''[1234567890abcdef]{12}'\'' -o | xargs -L1 docker rmi'
alias dclean='docker ps -a | grep -v '\''CONTAINER\|_config\|_data\|_run'\'' | cut -c-12 | xargs docker rm'
# Kill all running containers.
alias dockerkillall='docker kill $(docker ps -q)'
# Delete all stopped containers.
alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
# Delete all untagged images.
alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
# Delete all stopped containers and untagged images.
alias dockerclean='dockercleanc || true && dockercleani'
# git
alias git-getbranchauthors="git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n"
alias gcm='git checkout master'
# xdg-user-dirs
alias godesktop='[ -e $(xdg-user-dir DESKTOP) ] && cd $(xdg-user-dir DESKTOP)'
alias godoc='[ -e $(xdg-user-dir DOCUMENTS) ] && cd $(xdg-user-dir DOCUMENTS)'
alias godownload='[ -e $(xdg-user-dir DOWNLOAD) ] && cd $(xdg-user-dir DOWNLOAD)'
alias gomusic='[ -e $(xdg-user-dir MUSIC) ] && cd $(xdg-user-dir MUSIC)'
alias gopublic='[ -e $(xdg-user-dir PUBLICSHARE) ] && cd $(xdg-user-dir PUBLICSHARE)'
alias gotempl='[ -e $(xdg-user-dir TEMPLATES) ] && cd $(xdg-user-dir TEMPLATES)'
alias govideo='[ -e $(xdg-user-dir VIDEOS) ] && cd $(xdg-user-dir VIDEOS)'
alias gowork='[ -e $(xdg-user-dir WORK) ] && cd $(xdg-user-dir WORK)'
alias goarchive='[ -e $(xdg-user-dir ARCHIVE) ] && cd $(xdg-user-dir ARCHIVE)'
# some special locations
alias godebian='cd ~/debian'
alias gofvwm='cd /home/jakob/src/fvwmverve/'
alias gofvwmsys='cd /usr/share/fvwm-verve/'
alias goserverconfig='cd $MSC_BASE'
alias gomyshellconfig='cd $MSC_BASE'
alias catmyshellconfiglog='cat $MSC_LOGFILE'
alias goxund='cd /home/jakob/xundeenergie.at/'
# system-dirs
alias gosystemd='cd /etc/systemd/system/'
alias goudevrules='cd /etc/udev/rules.d/'
alias gousrlocal='cd /usr/local/'
alias gousrlocalbin='cd /usr/local/bin/'
alias gossh='[ -e $(xdg-user-dir)/.ssh ] && cd $(xdg-user-dir)/.ssh'
alias gosshd='[ -e /etc/ssh ] && cd /etc/ssh'
# btrfs-backup
alias golocbak='cd /var/cache/btrfs_pool_SYSTEM/'
alias gorembak='cd /var/cache/backup/$HOSTNAME/'
alias lslocbak='ls -alF /var/cache/btrfs_pool_SYSTEM/'
alias lsrembak='ls -alF /var/cache/backup/$HOSTNAME/'
# common commands
alias ....='cd ../../..'
alias ...='cd ../..'
alias ..='cd ..'
alias cd..='cd ..'
alias cp='cp -i --reflink=auto'
alias dir='ls -l $LS_OPTIONS'
alias grep='grep --color'
alias la='ls -la $LS_OPTIONS'
alias ll='ls -l $LS_OPTIONS'
alias l='ls -alF $LS_OPTIONS'
alias ls-l='ls -l $LS_OPTIONS'
alias md='mkdir -p'
alias rd=rmdir
alias rmbrokenlinks='for f in $(find -L . -maxdepth 1 -type l); do unlink "$f";done'
# mount/unmount
alias m=mount
alias u=umount
# tests
alias testmail='echo testemail von ${USER}@${HOSTNAME} am $(date)|mail -s "TESTEMAIL ${USER}@${HOSTNAME} $(date)"'
# logging
alias tailexim='sudo tail -f /var/log/mail.log /var/log/exim4/mainlog /var/log/exim4/rejectlog /var/log/exim4/paniclog'
alias tailmail='sudo journalctl -f -u exim4.service -u dovecot.service -u rspamd.service -u getmail*'
alias taildemsg='sudo watch -n1 "dmesg|tail -n20"'
alias tailsys='sudo tail -f /var/log/syslog /var/log/dmesg'
# infos, stati
alias getrelease='cat /etc/*release'
alias mkbackupinfo='mkbackup -Vi list SNP BKP SRC'
alias myip='curl "http://icanhazip.com/"'
alias netzwerk='watch "route; echo iwconfig; iwconfig 2> /dev/null ;echo; echo ifconfig; ifconfig 2> /dev/null; echo; echo arp -a; arp -a; echo EOF"'
# Applications
alias jq='jq -C'
alias ncmpcpp='ncmpcpp -h "${MPD_HOST}" -p "${MPD_PORT}"'
alias nedit='LC_ALL=ISO-8850-15;export LC_ALL;nedit -fn win8x15 -xrm "*fontList:win8x15"'
alias o='less -r'
alias totem='VDPAU_DRIVER=va_gl totem'
alias unetbootin='export QT_X11_NO_MITSHM=1 unetbootin'
alias vi='/usr/bin/vim'
alias vlc='VDPAU_DRIVER=va_gl vlc'
alias tmux='tmux -f ~/.tmux.conf'
alias youtube-dl-whole-video="youtube-dl -i --no-overwrites --write-description --write-info-json --write-annotations --write-all-thumbnails -f 'mp4' -o '%(title)s-%(id)s.%(ext)s' -w -c "
alias youtube-dl-whole-video-to-playlistdir="youtube-dl -i --no-overwrites --write-description --write-info-json --write-annotations --write-all-thumbnails -f 'mp4' -o '%(uploader)s/%(playlist)s/%(title)s-%(id)s.%(ext)s' -w -c "
alias youtube-dl-whole-user="youtube-dl -i --no-overwrites --yes-playlist --write-description --write-info-json --write-annotations --write-all-thumbnails -f 'mp4' -o '%(uploader)s/%(playlist)s/%(title)s-%(id)s.%(ext)s' -w -c "
alias youtube-dl-whole-playlist="youtube-dl -i --no-overwrites --yes-playlist --write-description --write-info-json --write-annotations --write-all-thumbnails -f 'mp4' -o '%(playlist)s/%(title)s-%(id)s.%(ext)s' -w -c "
alias youtube-dl-mp4-best="youtube-dl -i --no-overwrites --yes-playlist --write-description --write-info-json --write-annotations --write-all-thumbnails -f 'mp4' -o '%(title)s-%(id)s.%(ext)s' -w -c "
# rock64
alias rock64='sudo minicom -D /dev/ttyUSB0 --color=on'
alias rock64='sudo minicom -D /dev/ttyUSB0 -b 1500000--color=on'
# openvpn
alias ovpnrestart='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl restart openvpn-client@${HOSTNAME}.service'
alias ovpnstart='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl start openvpn-client@${HOSTNAME}.service'
alias ovpnstatus='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl status openvpn-client@${HOSTNAME}.service; echo; ip a'
alias ovpnstop='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl stop openvpn-client@${HOSTNAME}.service'
# systemd
alias scdr='systemctl daemon-reload'
alias scpo='systemctl poweroff'
alias scrb='systemctl reboot'
alias scrl='systemctl reload'
alias scrs='systemctl restart'
alias scs='systemctl start'
alias scstp='systemctl stop'
alias scst='systemctl status'
alias sc='systemctl'
alias sscdr='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl daemon-reload'
alias sscpo='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl poweroff'
alias sscrb='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl reboot'
alias sscrl='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl reload'
alias sscrs='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl restart'
alias sscs='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl start'
alias sscstp='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl stop'
alias sscst='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl status'
alias ssc='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemctl'
alias sda='[ $(id -u) -ne 0 ] && { S=sudo; } || { S="" ; } ; $S systemd-analyze plot > /tmp/bootchart.svg && eog /tmp/bootchart.svg&'
# remote control
# tinakisti
alias tinakistioff='ssh tinakisti sudo systemctl poweroff'
alias tinakistisuspend='ssh tinakisti sudo systemctl suspend'
alias tinakistireboot='ssh tinakisti sudo systemctl reboot'
# aldebaran
alias aldebaranoff='ssh aldebaran sudo systemctl poweroff'
alias aldebaransuspend='ssh aldebaran sudo systemctl suspend'
alias aldebaranreboot='ssh aldebaran sudo systemctl reboot'
## hostname
#alias hostnameoff='ssh hostname sudo systemctl poweroff'
#alias hostnamesuspend='ssh hostname sudo systemctl suspend'
#alias hostnamereboot='ssh hostname sudo systemctl reboot'
# nextcloud
alias nextcloud-add-missing-indices='docker exec -ti nc_app_1 php occ db:add-missing-indices'
alias nextcloud-upgrade='docker-compose down && docker image rm nc_app:latest nc_web:latest && docker-compose pull && docker-compose up --build -d'
#--- JIRA ---
alias gojiralib='cd /opt/atlassian/jira/atlassian-jira/WEB-INF/lib/'
alias gojirainstall='cd /opt/atlassian/jira/'
alias gojirahome='cd /var/atlassian/application-data/jira/'
alias gojiralog='cd /var/atlassian/application-data/jira/log'
alias tailjra='cd /var/atlassian/application-data/jira/log; tail -F atlassian-jira.log'
#--- CONFLUENCE ---
alias gocnflib='cd /opt/atlassian/confluence/confluence/WEB-INF/lib/'
alias gocnfinstall='cd /opt/atlassian/confluence/'
alias gocnfhome='cd /var/atlassian/application-data/confluence/'
alias gocnflog='cd /var/atlassian/application-data/confluence/logs'
alias tailcnf='cd /var/atlassian/application-data/confluence/logs; tail -F atlassian-confluence.log'
# eToken
alias agent='eval "$(<~/.ssh-agent)"'
# PasswordStore
alias passbmi='PASSWORD_STORE_DIR=~/.password-store/bmi pass'
alias passebcont='PASSWORD_STORE_DIR=~/.password-store/ebcont pass'