# # In ~/.config/fish/configs/alias_useful.fish # ################ COMMON ALIASES ################################################ alias remount='sudo mount -a' alias mount_config='sudo nano /etc/fstab' alias own='sudo chown -R "$USER":"$USER"' alias right='sudo chmod -R 755' alias reload='clear && omf reload' alias fish_config='nano $HOME/.config/fish/config.fish' alias ip='ip -color' alias psmem='ps auxf | sort -nr -k 4' alias psmem10='ps auxf | sort -nr -k 4 | head -10' alias jctl='journalctl -p 3 -xb' alias ...='cd ../..' alias ....='cd ../../..' alias .....='cd ../../../..' alias ......='cd ../../../../..' alias dir='dir --color=auto' alias vdir='vdir --color=auto' alias tarnow='tar -acf' alias untar='tar -zxvf' ################ HELPERS ###################################################### function help_pdf echo "Best Tool to combine pdf: PDF Arranger" echo "Best Tool for OCR: OCRMYPDF but you need to install the tesseracts for your languages" echo "Best Tool to write in PDFs: XOURNAL++" end if test -e /usr/bin/rsync function rcp if test (count $argv) -lt 2 echo "Usage: rcp SOURCE... DESTINATION" return 1 end rsync -avh --progress $argv end function rmv if test (count $argv) -lt 2 echo "Usage: rmv SOURCE... DESTINATION" return 1 end rsync -avh --progress --remove-source-files $argv end else function rcp echo "'rsync' is not installed. Install it via your package manager." end function rmv echo "'rsync' is not installed. Install it via your package manager." end end if test -e /usr/bin/nano function nanorm if test (count $argv) -lt 1 echo "Usage: nanorm {FILE}" return 1 end nano $argv[1] end else function nanorm echo "'nano' is not installed. Install it via your package manager." end end function source --description "Source files with auto-detection (replaces builtin source)" if test (count $argv) -eq 0 builtin source return end set file $argv[1] set -e argv[1] if string match -q -- "--*" $file builtin source $file $argv return end if not test -f "$file" echo "source: No such file: '$file'" >&2 return 1 end if string match -q "*.bash" -- $file if command -q bass bass source $file $argv else echo "source: 'bass' is not installed. Install it to source .bash files." >&2 return 1 end else builtin source $file $argv end end ################ TERMINAL-SPECIFIC ############################################ if test "$TERM" = "xterm-kitty" alias icat='kitty +kitten icat' end ################ PYTHON ####################################################### if test -e /usr/bin/python3 alias python='python3' alias py='python3' end if test -e /usr/bin/python3 function mkvenv if not python3 -c "import venv" ^/dev/null echo "Python3 'venv' module is not available. Install python3-venv via your package manager." return 1 end if test (count $argv) -lt 1 echo "Usage: mkvenv {folder name}" return 1 end python3 -m venv $argv[1] if test -f $argv[1]/bin/activate.fish source $argv[1]/bin/activate.fish else echo "Error: Could not find activate.fish in $argv[1]/bin/" return 1 end end else function mkvenv echo "Python3 is not installed. Please install Python3 to use mkvenv." end end if test -e /usr/bin/python3 function src if not test -d .venv echo "Cannot activate: .venv directory does not exist." return 1 end if not test -d .venv/bin echo "Cannot activate: .venv/bin directory does not exist." return 1 end if test -f .venv/bin/activate.fish source .venv/bin/activate.fish return 0 end if test -f .venv/bin/activate.bash if test -e /usr/bin/bass bass source .venv/bin/activate.bash return 0 else echo "'bass' is not installed. Install it via your package manager to source bash scripts." return 1 end end echo "No usable activation script found in .venv/bin/" return 1 end else function src echo "Python3 is not installed. Please install Python3 to use src." end end ################ OLLAMA ###################################################### if test -e /usr/bin/ollama alias llama_start='ollama serve' alias llama3='ollama run llama3' end ################ EZA ########################################################## if test -x /usr/bin/eza function ls command eza -a --color=always --group-directories-first --icons $argv end function lr command eza -al --color=always --group-directories-first --icons $argv end function ll command eza -l --color=always --group-directories-first --icons $argv end function lt command eza -aT --color=always --group-directories-first --icons $argv end function l. command eza -ald --color=always --group-directories-first --icons .* $argv end function lf command eza -aD --color=always --group-directories-first --icons $argv end else for cmd in lr ll lt l. lf function $cmd --inherit-variable cmd echo "The command 'eza' is not installed. Please install 'eza' to use this: https://github.com/eza-community/eza" end end end ################ BTOP ######################################################### if test -e /usr/bin/btop alias tasks='btop' end ################ MPV ########################################################## if test -e /usr/bin/mpv alias uni_play='mpv --vo=tct' alias asci_play='mpv --vo=caca' else for cmd in uni_play asci_play function $cmd --inherit-variable cmd echo "The command 'mpv' is not installed. Please install mpv to use this: https://github.com/mpv-player/mpv" end end end ################ GREP ######################################################### if test -e /usr/bin/ugrep alias grep='ugrep --color=auto' alias egrep='ugrep -E --color=auto' alias fgrep='ugrep -F --color=auto' else alias egrep='grep -E' alias fgrep='grep -F' end ################ WGET ######################################################### if test -e /usr/bin/wget alias wget='wget -c' end ################ OCRMYPDF ##################################################### if test -e /usr/bin/ocrmypdf alias ocrmypdf='ocrmypdf --deskew --clean --rotate-pages' else function ocrmypdf echo "The command 'ocrmypdf' is not installed. Install it via your package manager: https://github.com/ocrmypdf/OCRmyPDF" end end ################ YAZI ######################################################### if test -e /usr/bin/yazi function y set tmp (mktemp -t "yazi-cwd.XXXXXX") yazi $argv --cwd-file="$tmp" if read -z cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] builtin cd -- "$cwd" end rm -f -- "$tmp" end else for cmd in yazi y function $cmd --inherit-variable cmd echo "The command 'yazi' is not installed. Please install 'yazi' to use this: https://github.com/sxyazi/yazi" end end end ################ SUDO ######################################################### if test -e /usr/bin/sudo-rs alias sudo=sudo-rs end ################ FLASH ISO #################################################### if test -e /usr/bin/dd function flashiso --description "Flash an ISO to a target drive with dd" if test (count $argv) -ne 2 echo "Usage: flashiso {ISO} {target drive}" echo "Example: flashiso ubuntu-25.10-desktop-amd64.iso /dev/sdb" return 1 end sudo dd if=$argv[1] of=$argv[2] bs=4M status=progress oflag=sync end end ################ GIT ########################################################## function git_cred if test -f .git/config # Check if the credential helper is already in the file if grep -q "git-honney333-work-cred" .git/config echo "Credential helper is already configured in .git/config" else echo "Adding Password tool to git" # Append the blocks with a clean newline separator echo -e "\n[credential]\n helper = !"$HOME"/.bin/git-honney333-work-cred" >> .git/config end else echo "no .git/config file" echo "could not add the credentials helper" end end