mirror of
https://github.com/Snigdha-OS/snigdhaos-roots.git
synced 2025-09-05 23:56:38 +02:00
308 lines
8.8 KiB
Bash
308 lines
8.8 KiB
Bash
append_path () {
|
|
case ":$PATH:" in
|
|
*:"$1":*)
|
|
;;
|
|
*)
|
|
PATH="${PATH:+$PATH:}$1"
|
|
esac
|
|
}
|
|
append_path "$HOME/bin"
|
|
append_path "$HOME/.local/bin"
|
|
|
|
### EXPORT ###
|
|
export EDITOR=/usr/bin/nvim
|
|
export VISUAL='nano'
|
|
export HISTCONTROL=ignoreboth:erasedups:ignorespace
|
|
HISTSIZE=100000
|
|
HISTFILESIZE=2000000
|
|
# shopt -s histappend
|
|
export PAGER='most'
|
|
|
|
|
|
#Ibus settings if you need them
|
|
#type ibus-setup in terminal to change settings and start the daemon
|
|
#delete the hashtags of the next lines and restart
|
|
#export GTK_IM_MODULE=ibus
|
|
#export XMODIFIERS=@im=dbus
|
|
#export QT_IM_MODULE=ibus
|
|
|
|
# PS1=
|
|
# PS1="\[\033[1;34m\][\$(date +%H%M)][\u@\h:\w]$\[\033[0m\] "
|
|
if [[ $(tty) == */dev/tty* ]]; then
|
|
PS1="\e[1;31m[\u\e[1;32mIP: $(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev) | \e[1;31m]\n[>]\[\e[1;31m\]\$(pwd) $ \[\e[0m\]"
|
|
else
|
|
PS1="\e[1;31m┌──[I'm \u\e[0m➜ \e[1;32mPublic IP: $(ip -4 addr | grep -v '127.0.0.1' | grep -v 'secondary' | grep -oP '(?<=inet\s)\d+(\.\d+){3}' | sed -z 's/\n/|/g;s/|\$/\n/' | rev | cut -c 2- | rev)🔒\e[1;31m]\n└──╼[\e[1;32mSNIGDHA OS\e[1;31m]\[\e[1;31m\]\$(pwd)\n$ Command: \[\e[0m\]"
|
|
fi
|
|
|
|
|
|
# If not running interactively, don't do anything
|
|
[[ $- != *i* ]] && return
|
|
|
|
|
|
if [ -d "$HOME/.bin" ] ;
|
|
then PATH="$HOME/.bin:$PATH"
|
|
fi
|
|
|
|
if [ -d "$HOME/.local/bin" ] ;
|
|
then PATH="$HOME/.local/bin:$PATH"
|
|
fi
|
|
|
|
#ignore upper and lowercase when TAB completion
|
|
bind "set completion-ignore-case on"
|
|
|
|
### ALIASES ###
|
|
|
|
#list
|
|
alias ls='ls --color=auto'
|
|
alias la='ls -a'
|
|
alias ll='ls -alFh'
|
|
alias l='ls'
|
|
alias l.="ls -A | egrep '^\.'"
|
|
alias listdir="ls -d */ > list"
|
|
alias del="sudo rm -rf"
|
|
alias c='clear'
|
|
alias q='exit'
|
|
|
|
#pacman
|
|
alias sps='sudo pacman -S'
|
|
alias install="sudo pacman -S"
|
|
alias yes="yay -S"
|
|
alias spr='sudo pacman -R'
|
|
alias sprs='sudo pacman -Rs'
|
|
alias uninstall="sudo pacman -Rs"
|
|
alias sprdd='sudo pacman -Rdd'
|
|
alias spqo='sudo pacman -Qo'
|
|
alias spsii='sudo pacman -Sii'
|
|
|
|
# show the list of packages that need this package - depends mpv as example
|
|
function_depends() {
|
|
search=$(echo "$1")
|
|
sudo pacman -Sii $search | grep "Required" | sed -e "s/Required By : //g" | sed -e "s/ /\n/g"
|
|
}
|
|
|
|
alias depends='function_depends'
|
|
|
|
#fix obvious typo's
|
|
alias cd..='cd ..'
|
|
alias pdw='pwd'
|
|
alias udpate='sudo snigdhaos-updater'
|
|
alias upd='sudo snigdhaos-updater'
|
|
alias upate='sudo snigdhaos-updater'
|
|
alias updte='sudo snigdhaos-updater'
|
|
alias updqte='sudo snigdhaos-updater'
|
|
alias upqll='paru -Syu --noconfirm'
|
|
alias upal='paru -Syu --noconfirm'
|
|
|
|
## Colorize the grep command output for ease of use (good for log files)##
|
|
alias grep='grep --color=auto'
|
|
alias egrep='egrep --color=auto'
|
|
alias fgrep='fgrep --color=auto'
|
|
|
|
#readable output
|
|
alias df='df -h'
|
|
|
|
#pacman unlock
|
|
alias unlock="sudo rm /var/lib/pacman/db.lck"
|
|
alias rmpacmanlock="sudo rm /var/lib/pacman/db.lck"
|
|
|
|
#free
|
|
alias free="free -mt"
|
|
|
|
#continue download
|
|
alias wget="wget -c"
|
|
|
|
#userlist
|
|
alias userlist="cut -d: -f1 /etc/passwd | sort"
|
|
|
|
#merge new settings
|
|
alias merge="xrdb -merge ~/.Xresources"
|
|
|
|
# Aliases for software managment
|
|
# pacman or pm
|
|
alias pacman='sudo pacman --color auto'
|
|
alias update='sudo snigdhaos-updater'
|
|
alias upd='sudo snigdhaos-updater'
|
|
|
|
# paru as aur helper - updates everything
|
|
alias pksyua="paru -Syu --noconfirm"
|
|
alias upall="paru -Syu --noconfirm"
|
|
alias upa="paru -Syu --noconfirm"
|
|
|
|
#ps
|
|
alias psa="ps auxf"
|
|
alias psgrep="ps aux | grep -v grep | grep -i -e VSZ -e"
|
|
|
|
#grub update
|
|
alias update-grub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
|
alias grub-update="sudo grub-mkconfig -o /boot/grub/grub.cfg"
|
|
|
|
#add new fonts
|
|
alias update-fc='sudo fc-cache -fv'
|
|
#switch between bash and zsh
|
|
alias tobash="sudo chsh $USER -s /bin/bash && echo 'Now log out.'"
|
|
alias tozsh="sudo chsh $USER -s /bin/zsh && echo 'Now log out.'"
|
|
alias tofish="sudo chsh $USER -s /bin/fish && echo 'Now log out.'"
|
|
|
|
#switch between displaymanager or bootsystem
|
|
alias toboot="sudo /usr/local/bin/snigdha-toboot"
|
|
alias togrub="sudo /usr/local/bin/snigdha-togrub"
|
|
|
|
#audio check pulseaudio or pipewire
|
|
alias audio="pactl info | grep 'Server Name'"
|
|
|
|
#skip integrity check
|
|
alias paruskip='paru -S --mflags --skipinteg'
|
|
alias yayskip='yay -S --mflags --skipinteg'
|
|
alias trizenskip='trizen -S --skipinteg'
|
|
|
|
#check vulnerabilities microcode
|
|
alias microcode='grep . /sys/devices/system/cpu/vulnerabilities/*'
|
|
|
|
#check cpu
|
|
alias cpu="cpuid -i | grep uarch | head -n 1"
|
|
|
|
# enable virtudal box services
|
|
alias start-vmware="sudo systemctl enable --now vmtoolsd.service"
|
|
alias vmware-start="sudo systemctl enable --now vmtoolsd.service"
|
|
alias sv="sudo systemctl enable --now vmtoolsd.service"
|
|
|
|
#shopt
|
|
shopt -s autocd # change to named directory
|
|
shopt -s cdspell # autocorrects cd misspellings
|
|
shopt -s cmdhist # save multi-line commands in history as single line
|
|
shopt -s dotglob
|
|
shopt -s histappend # do not overwrite history
|
|
shopt -s expand_aliases # expand aliases
|
|
|
|
#Recent Installed Packages
|
|
alias rip="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -200 | nl"
|
|
alias riplong="expac --timefmt='%Y-%m-%d %T' '%l\t%n %v' | sort | tail -3000 | nl"
|
|
|
|
#iso and version used
|
|
alias iso="cat /etc/dev-rel | awk -F '=' '/ISO/ {print $2}'"
|
|
alias isoo="cat /etc/dev-rel"
|
|
|
|
#Cleanup orphaned packages
|
|
alias cleanup='sudo pacman -Rns $(pacman -Qtdq)'
|
|
|
|
# This will generate a list of explicitly installed packages
|
|
alias list="sudo pacman -Qqe"
|
|
#This will generate a list of explicitly installed packages without dependencies
|
|
alias listt="sudo pacman -Qqet"
|
|
# list of AUR packages
|
|
alias listaur="sudo pacman -Qqem"
|
|
# add > list at the end to write to a file
|
|
|
|
# install packages from list
|
|
# pacman -S --needed - < my-list-of-packages.txt
|
|
|
|
#clear
|
|
alias clean="clear; seq 1 $(tput cols) | sort -R | sparklines | lolcat"
|
|
|
|
#search content with ripgrep
|
|
alias rg="rg --sort path"
|
|
|
|
#gpg
|
|
#verify signature for isos
|
|
alias gpg-check="gpg2 --keyserver-options auto-key-retrieve --verify"
|
|
alias fix-gpg-check="gpg2 --keyserver-options auto-key-retrieve --verify"
|
|
#receive the key of a developer
|
|
alias gpg-retrieve="gpg2 --keyserver-options auto-key-retrieve --receive-keys"
|
|
alias fix-gpg-retrieve="gpg2 --keyserver-options auto-key-retrieve --receive-keys"
|
|
alias fix-keyserver="[ -d ~/.gnupg ] || mkdir ~/.gnupg ; cp /etc/pacman.d/gnupg/gpg.conf ~/.gnupg/ ; echo 'done'"
|
|
|
|
#maintenance
|
|
alias big="expac -H M '%m\t%n' | sort -h | nl"
|
|
|
|
#hblock (stop tracking with hblock)
|
|
#use unhblock to stop using hblock
|
|
alias unhblock="hblock -S none -D none"
|
|
|
|
#systeminfo
|
|
alias probe="sudo -E hw-probe -all -upload"
|
|
alias sysfailed="systemctl list-units --failed"
|
|
|
|
#shutdown or reboot
|
|
alias ssn="sudo shutdown now"
|
|
alias sr="reboot"
|
|
|
|
#update betterlockscreen images
|
|
alias bls="betterlockscreen -u /usr/share/backgrounds/snigdha-wallpapers/"
|
|
|
|
#give the list of all installed desktops - xsessions desktops
|
|
alias xd="ls /usr/share/xsessions"
|
|
alias xdw="ls /usr/share/wayland-sessions"
|
|
|
|
#give a list of the kernels installed
|
|
alias kernel="ls /usr/lib/modules"
|
|
alias kernels="ls /usr/lib/modules"
|
|
|
|
#am I on grub or systemd-boot
|
|
alias boot="sudo bootctl status | grep Product"
|
|
|
|
# # ex = EXtractor for all kinds of archives
|
|
# # usage: ex <file>
|
|
ex ()
|
|
{
|
|
if [ -f $1 ] ; then
|
|
case $1 in
|
|
*.tar.bz2) tar xjf $1 ;;
|
|
*.tar.gz) tar xzf $1 ;;
|
|
*.bz2) bunzip2 $1 ;;
|
|
*.rar) unrar x $1 ;;
|
|
*.gz) gunzip $1 ;;
|
|
*.tar) tar xf $1 ;;
|
|
*.tbz2) tar xjf $1 ;;
|
|
*.tgz) tar xzf $1 ;;
|
|
*.zip) unzip $1 ;;
|
|
*.Z) uncompress $1;;
|
|
*.7z) 7z x $1 ;;
|
|
*.deb) ar x $1 ;;
|
|
*.tar.xz) tar xf $1 ;;
|
|
*.tar.zst) tar xf $1 ;;
|
|
*) echo "'$1' cannot be extracted via ex()" ;;
|
|
esac
|
|
else
|
|
echo "'$1' is not a valid file"
|
|
fi
|
|
}
|
|
|
|
#wayland aliases
|
|
alias wsimplescreen="wf-recorder -a"
|
|
alias wsimplescreenrecorder="wf-recorder -a -c h264_vaapi -C aac -d /dev/dri/renderD128 --file=recording.mp4"
|
|
|
|
#btrfs aliases
|
|
alias btrfsfs="sudo btrfs filesystem df /"
|
|
alias btrfsli="sudo btrfs su li / -t"
|
|
|
|
#snapper aliases
|
|
alias snapcroot="sudo snapper -c root create-config /"
|
|
alias snapchome="sudo snapper -c home create-config /home"
|
|
alias snapli="sudo snapper list"
|
|
alias snapcr="sudo snapper -c root create"
|
|
alias snapch="sudo snapper -c home create"
|
|
|
|
#git
|
|
alias rmgitcache="rm -r ~/.cache/git"
|
|
alias grh="git reset --hard"
|
|
|
|
#pamac
|
|
alias pamac-unlock="sudo rm /var/tmp/pamac/dbs/db.lock"
|
|
|
|
#moving your personal files and folders from /personal to ~
|
|
alias personal='cp -Rf /personal/* ~'
|
|
alias sn="gpg --detach-sign"
|
|
alias gc="git clone"
|
|
alias gp="git push"
|
|
alias gm="git commit -m"
|
|
|
|
|
|
#create a file called .bashrc-personal and put all your personal aliases
|
|
#in there. They will not be overwritten by skel.
|
|
|
|
# [[ -f ~/.bashrc-personal ]] && . ~/.bashrc-personal
|
|
|
|
if [[ $1 != no-repeat-flag && -z $NO_REPETITION ]]; then
|
|
neofetch
|
|
fi
|