Files
Server-scripts/other/bash_aliases.universal
T

193 lines
8.4 KiB
Bash
Raw Normal View History

2026-09-14 09:50:00 +02:00
HOST=$(hostname)
2026-10-12 20:40:28 +02:00
LOCAL_SCRIPTS="/home/lucas/scripts"
2026-09-14 09:50:00 +02:00
alias please="sudo"
alias NC_scripts="cd ${NC_SCRIPTS}"
alias regex_rename="${LOCAL_SCRIPTS}/rename.sh"
alias profile="${LOCAL_SCRIPTS}/profile_motd.sh"
alias auto_update="${LOCAL_SCRIPTS}/utils/upgrade.sh"
2026-09-14 09:50:00 +02:00
alias aptgrep="apt list --installed | grep -i "
alias reboot="sudo /sbin/reboot"
alias shutdown="sudo /sbin/shutdown"
alias sound_up="pactl -- set-sink-volume 0 +10%"
alias TU_vpn="sudo openconnect --user e1629051@student.tuwien.ac.at vpn.tuwien.ac.at"
alias psgrep="ps -elf | grep -v grep | grep -i "
alias vpn="sudo ${LOCAL_SCRIPTS}/network/networksettings.sh"
alias pubip="wget -T 5 -qO- ifconfig.co"
alias pubip_country="wget -T 5 -qO- ifconfig.co/country"
alias ipinfo='${LOCAL_SCRIPTS}/ip_info.sh'
alias pygen="/home/lucas/scripts/.venv/bin/python3"
2026-10-12 20:40:28 +02:00
alias mediawake="bash ${LOCAL_SCRIPTS}/network/wol.sh mediahost -c"
alias serverwake="bash ${LOCAL_SCRIPTS}/network/wol.sh serverhost -c"
alias quietwake="bash ${LOCAL_SCRIPTS}/network/wol.sh quiethost"
2026-09-14 09:50:00 +02:00
if [[ "${HOST}" == "quiethost" ]] || [[ "${HOST}" == "serverhost" ]]; then
### Veracrypt aliases
#Passwd Mount and Grep
alias passwd_mount="sudo veracrypt -t --mount --non-interactive --stdin $DOC_DIR/Dokumente/Zeug/passwd /media/veracrypt_passwd && clear"
alias passwd_dismount="sudo veracrypt --dismount $DOC_DIR/Dokumente/Zeug/passwd && touch $DOC_DIR/Dokumente/Zeug/passwd"
alias passwd_grep="grep -i -A1 /media/veracrypt_passwd/passwd.txt -e "
#System mounts
alias system_mount="sudo veracrypt -t --mount --non-interactive --stdin /data/SystemData/Sys64/System_Data /media/veracrypt_system && clear"
alias system_dismount="sudo veracrypt --dismount /data/SystemData/Sys64/System_Data"
#vera
alias vera_mount="sudo veracrypt -t --mount --non-interactive --stdin //media/veracrypt_system/System32/SystemData/IMG.file /media/veracrypt_vera && clear"
alias vera_dismount="sudo veracrypt --dismount /media/veracrypt_system/System32/SystemData/IMG.file"
#no intenet
alias no_inet="sudo -s -g no-internet"
alias recipeAI="~/.venv_general/bin/python3 ~/scripts/quiethost/generateNutritionInfowithGemini.py /data/Nextcloud/Documents/Dokumente/Shared/Diverses/Kochbuch/RecepiesLucas/"
alias ffmepeg_handling="~/.venv_general/bin/python3 ~/scripts/ffmpeg_handling.py"
fi
if [ "${HOST}" != "serverhost" ]; then
alias serverhost="ssh -X serverhost"
alias lstorr="ssh serverhost du -a -d1 -h /torrent/complete/ | sed 's/\/torrent\/complete\///'g | head -n -1"
alias delugecopy='bash ${LOCAL_SCRIPTS}/copy.sh -h deluge -f '
alias servercopy='bash ${LOCAL_SCRIPTS}/copy.sh -h serverhost -f '
alias scriptcopy="ssh serverhost bash /home/lucas/scripts/scriptcopy.sh"
#Dinfo
alias dinfo="ssh serverhost ${LOCAL_SCRIPTS}/deluge-client.sh"
elif [ "${HOST}" != "vivohost" ];then
# Copy Torrents
alias ytlistdownload="screen -S ytdown bash /home/lucas/scripts/youtube.sh -L"
copytorrents() {
screen -S cptorr bash -c "/home/lucas/scripts/serverhost/copytorrents.sh -l -y $@; read"
}
# Print
alias print="lpr -P hp-LaserJet-1300 "
alias scriptcopy='bash ${LOCAL_SCRIPTS}/scriptcopy.sh'
# Serverhost Network Commands
alias occ_scan="sudo bash ${LOCAL_SCRIPTS}/Nextcloud/nextcloud_scan.sh"
alias netstat="sudo bash ${LOCAL_SCRIPTS}/network/state.sh"
alias routing="sudo ${LOCAL_SCRIPTS}/network/rev_routing.sh"
alias IPtables-save="sudo sh -c 'iptables-save > /etc/network/iptables'"
# Serverhost Deluge Commands
alias rmTorr="bash ${LOCAL_SCRIPTS}/removeTorrents.sh"
alias dadd='duser deluge-console add'
alias deluge="duser deluged && sleep 0.2 && duser deluge-console"
alias deluge-console='duser deluge-console'
alias del='if [[ $(psgrep delug | wc -l) -eq 0 ]]; then vpn; fi; duser deluge-console'
alias deluged="duser deluged"
alias duser="sudo ${LOCAL_SCRIPTS}/serverhost/deluge_user_cmd.sh"
alias dpubip="duser wget -T 5 -qO- ifconfig.co"
alias dpubip_country="duser wget -T 5 -qO- ifconfig.co/country"
alias lstorr="du -a -d1 -h /torrent/complete/ | sed 's/\/torrent\/complete\///'g | head -n -1"
# Serverhost NCSync
alias occ="sudo -u www-data php /nextcloud/nextcloud/occ"
#Dinfo
alias dinfo="${LOCAL_SCRIPTS}/serverhost/deluge-client.sh"
# Wallpaper Changer
alias WC="bash /home/lucas/scripts/serverhost/WallpaperChangerServer.sh"
# Auto shutdown
alias autoshutdown_enable="echo "yes" > /home/lucas/.auto_shutdown"
alias autoshutdown_disable="echo "no" > /home/lucas/.auto_shutdown"
fi
if [ "${HOST}" != "quiethost" ]; then
alias quiethost="ssh -X quiethost"
alias quietcopy='bash ${LOCAL_SCRIPTS}/copy.sh -h quiethost -f '
elif [ "${HOST}" != "vivohost" ];then
# XRDP duser@serverhost
alias serverxrdp="xfreerdp /bpp:32 /kbd:german /u:deluge-user /v:10.0.0.2 /port:3389 /cert-ignore /size:1920x950 /relax-order-checks +glyph-cache"
# Iptables
alias firewall="sudo /home/lucas/Documents/Dokumente/Projekte/Server/scripts/iptables_basic.sh"
# Torrents
alias torrentcopy="bash /home/lucas/scripts/quiethost/torrentcopy.sh"
# Screenshot
alias scrsht="bash /home/lucas/scripts/screenschot_grab.sh"
# Boot to Windows
alias winboot="sudo efibootmgr --bootnext 0000 && reboot"
# Boot to Windows
alias winhiber="sudo /home/lucas/scripts/enable-hibernate-reboot && sudo efibootmgr --bootnext 0003 && sudo systemctl hibernate"
# 3DVS mount
alias 3dvs_mount="sudo veracrypt -t --mount --non-interactive --stdin /data/SystemData/SystemGame3DSV2_10 /media/veracrypt_3DSV && clear"
alias 3dvs_dismount="sudo veracrypt --dismount /data/SystemData/SystemGame3DSV2_10"
# FFMPEG
# jpg2png
alias imconv="bash ${LOCAL_SCRIPTS}/img_type.sh"
alias FFmpeg="bash /home/lucas/scripts/ffmpeg_handling.sh"
# Wallpaper Changer
alias WC="bash /data/Nextcloud/Documents/Dokumente/Projekte/Server/scripts/serverhost/WallpaperChangerServer.sh"
# Display Modes
alias mode_work="xrandr --output HDMI-1-1 --off && bash /home/lucas/scripts/wallpaperChanger.sh"
alias mode_norm="xrandr --output eDP-1-1 --output HDMI-1-1 --auto --primary --left-of eDP-1-1 && bash /home/lucas/scripts/wallpaperChanger.sh"
# Repair Mouse
alias mouse_repair="sudo /home/lucas/scripts/repair_mouse.sh"
alias sd_rm="rm -dr /home/lucas/stable-diffusion-webui/outputs/* /home/lucas/stable-diffusion-webui/log/images/*"
alias stable="cd /stable/stable-diffusion-webui/ && ./webui.sh"
alias comfiUI="cd /stable/ComfyUI/ && HSA_OVERRIDE_GFX_VERSION=10.3.0 python3 main.py"
fi
2026-09-25 11:48:21 +02:00
if [ "${HOST}" != "mediahost" ]; then
alias mediahost="ssh mediahost"
fi
2026-09-14 09:50:00 +02:00
if [ "${HOST}" == "vivohost" ]; then
alias labwake="sudo etherwake B4:2E:99:F1:82:3B -i wlo1"
#alias labhost="ssh ubuntu@LabNotebookUbuntu"
alias labhost="ssh labhost"
2026-09-25 11:48:21 +02:00
alias serverhost="ssh serverhost"
2026-09-14 09:50:00 +02:00
alias WC="bash /home/lucas/scripts/serverhost/WallpaperChangerServer.sh"
alias winboot="sudo efibootmgr --bootnext 0001 && sudo /usr/sbin/reboot"
fi
if [[ "${HOST}" == "quiethost" ]] || [[ "${HOST}" == "vivohost" ]]; then
DEFAULT_SUBNET=11
if [ "${HOST}" == "quiethost" ]; then
DEFAULT_SUBNET=0
fi
alias tcmcli="/usr/bin/python3 ~/git/calibration_gui/supportScripts/send_cli_command_lucas.py"
raspi() { x=$(echo $1 | grep -o '\.' | wc -l) ; if [[ $x -le 0 ]]; then ssh -X raspi@192.168.$DEFAULT_SUBNET.$1; elif [[ $x -eq 1 ]]; then ssh raspi@192.168.$1; elif [[ $x -eq 2 ]] ; then ssh raspi@192.$1; elif [[ $x -eq 3 ]]; then ssh raspi@$1; fi }
fi
dircreate() {
for file in *; do
[ -f "$file" ] || continue
dirname="${file%.*}"
# If no extension exists, use the full filename
[ "$dirname" = "$file" ] && dirname="$file"
mkdir -p "$dirname"
mv "$file" "$dirname/"
done
}
find_multi_video_dirs() {
local exts='mkv|mp4|avi|mov|m4v|wmv|flv|webm|ts'
find . -type d -print0 |
while IFS= read -r -d '' dir; do
count=$(find "$dir" -maxdepth 1 -type f \
| grep -Ei "\.($exts)$" \
| wc -l)
if (( count > 1 )); then
echo "$count videos: $dir"
fi
done
}
rename_dots() {
find . -depth | while IFS= read -r path; do
[[ "$path" == "." ]] && continue
base=$(basename "$path")
dir=$(dirname "$path")
if [[ -f "$path" && "$base" == *.tar.gz ]]; then
name="${base%.tar.gz}"
newbase="${name//./ }.tar.gz"
elif [[ -f "$path" && "$base" == *.* ]]; then
name="${base%.*}"
ext="${base##*.}"
newbase="${name//./ }.${ext}"
else
newbase="${base//./ }"
fi
if [[ "$base" != "$newbase" ]]; then
newpath="$dir/$newbase"
echo "Moving: '$path' -> '$newpath'"
mv -n -- "$path" "$newpath"
fi
done
}