myshellconfig/aliases
2024-09-13 16:25:24 +02:00

248 lines
13 KiB
Text

#Persönliche Aliases
# usefull commands
#alias fuck='f() { cmd=$1; shift; cmd=$(alias $cmd); echo sudo $cmd $@; }; f $(history -p \!\!)'
alias ap="ansible-playbook"
alias apv="ansible-playbook --ask-vault-pass"
alias fuck='sudo $(history -p \!\!)'
alias wosis='which $(history -p \!\!)'
alias fix='reset; stty sane; tput rs1; clear; echo -e "\033c"; printf "\033[3J"' # Fix terminal aber binary output
alias fixbmi='fixtoken; ssh -Oexit svras' # Fix terminal aber binary output
alias fixtoken='sudo systemctl restart pcscd.service' # 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'
alias umountshared='sudo systemctl stop media-remote-sharefs-userdata.mount'
alias musictag='python3 -m music_tag'
alias nestedwayland='dbus-run-session -- gnome-shell --nested --wayland'
alias xo='xdg-open .'
alias pwgeninitial='tr -dc "/17^.,l|Ii\0OL" </dev/urandom | head -c24'
# 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)'
# goarchive is now in functions.sh
# alias goarchive='[ -e $(xdg-user-dir ARCHIVE) ] && cd $(xdg-user-dir ARCHIVE)'
alias lsarchive='[ -e "$(xdg-user-dir ARCHIVE)" ] && ls -l "$(xdg-user-dir ARCHIVE)"'
alias treearchive='[ -e "$(xdg-user-dir ARCHIVE)" ] && tree "$(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 vi='/usr/bin/vimx'
#alias vi='which vimx > /dev/null && vimx || 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-audio-only="youtube-dl -i --no-overwrites --write-description --write-info-json --write-annotations --write-all-thumbnails -x -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-whole-playlist-audio-only="youtube-dl -i --no-overwrites --yes-playlist --write-description --write-info-json --write-annotations --write-all-thumbnails -x -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 gojrainstall='cd /opt/atlassian/jira/'
alias gojralib='cd /opt/atlassian/jira/atlassian-jira/WEB-INF/lib/'
alias gojraclasses='cd /opt/atlassian/jira/atlassian-jira/WEB-INF/classes/'
alias gojralog='getjrahomes; cd ${APP_HOME}/logs'
alias tailjra='getjrahomes; tail -F ${APP_HOME}/log/atlassian-jira.log ${APP_HOME}/log/pvp-authenticator.log'
alias tailjraall='getjrahomes; tail -F ${APP_HOME}/log/atlassian-jira.log ${APP_HOME}/log/pvp-authenticator.log /opt/atlassian/jira/logs/catalina.out'
#--- CONFLUENCE ---
alias gocnfinstall='cd /opt/atlassian/confluence/'
alias gocnflib='cd /opt/atlassian/confluence/confluence/WEB-INF/lib/'
alias gocnfclasses='cd /opt/atlassian/confluence/confluence/WEB-INF/classes/'
alias gocnflog='getcnfhomes; cd ${APP_HOME}/logs'
alias tailcnf='getcnfhomes; tail -F ${APP_HOME}/log/atlassian-jira.log ${APP_HOME}/logs/pvp-authenticator.log'
alias tailcnfall='getcnfhomes; tail -F ${APP_HOME}/log/atlassian-jira.log ${APP_HOME}/logs/pvp-authenticator.log /opt/atlassian/confluence/logs/catalina.out'
#--- ATLASSIAN Allgemein ---
alias goatinst='getatsvc; cd /opt/atlassian/${APP_NAME}/'
alias goatinstlog='getatsvc; cd /opt/atlassian/${APP_NAME}/logs/'
alias goatlib='getatsvc; cd /opt/atlassian/${APP_NAME}/${APP_INST_NAME}/WEB-INF/lib/'
alias goatclasses='getatsvc; cd /opt/atlassian/${APP_NAME}/${APP_INST_NAME}/WEB-INF/classes/'
alias goatlog='getatsvc; cd ${APP_HOME}/${APP_LOG_DIR}'
alias goatbkp='getatsvc; cd ${APP_HOME}/../../backups'
alias goatmbkp='getatsvc; cd ${APP_HOME}/../../mbackups'
alias goatpvp='getatsvc; cd ${APP_HOME:-$APP_SHARED_HOME}/pvp-authenticator'
alias tailat='getatsvc; tail -F ${APP_HOME}/${APP_LOG_DIR}/atlassian-${APP_NAME}.log'
alias tailpvp='getatsvc; tail -F ${APP_HOME}/${APP_LOG_DIR}/pvp-authenticator.log'
alias tailatpvp='getatsvc; tail -F ${APP_HOME}/${APP_LOG_DIR}/atlassian-${APP_NAME}.log ${APP_HOME}/${APP_LOG_DIR}/pvp-authenticator.log'
alias tailatall='getatsvc; tail -F ${APP_HOME}/${APP_LOG_DIR}/atlassian-${APP_NAME}.log ${APP_HOME}/${APP_LOG_DIR}/pvp-authenticator.log /opt/atlassian/${APP_NAME}/logs/catalina.out'
# 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'
alias visetenv='vi bin/setenv.sh'
alias viserverxml='vi conf/server.xml'
alias kxxx='killall gthumb ; uencfs /run/user/2000/decrypted/XXX '
# Bitwarden
alias bwunlock='eval $(bw unlock|grep export|sed "s/^\$ //")'