95 lines
3.1 KiB
Bash
95 lines
3.1 KiB
Bash
#!/bin/zsh
|
||
|
||
# Vim is a disease
|
||
alias :q="exit"
|
||
|
||
# Zoxide cd replacement
|
||
alias cd="z"
|
||
|
||
# Eza ls replacement
|
||
alias ls="command eza"
|
||
|
||
# Easier navigation: .., ..., ...., .....
|
||
alias cd..="cd .."
|
||
alias ..="cd .."
|
||
alias ...="cd ../.."
|
||
alias ....="cd ../../.."
|
||
alias .....="cd ../../../.."
|
||
alias ......="cd ../../../../.."
|
||
|
||
# Colours!
|
||
alias grep='grep --color=auto'
|
||
alias fgrep='fgrep --color=auto'
|
||
alias egrep='egrep --color=auto'
|
||
alias ip='ip --color=auto'
|
||
|
||
# File movement
|
||
alias backup="rsync -vrltD --progress --stats"
|
||
alias mkdir='mkdir -pv' #Intuitive mkdir
|
||
|
||
# alternative to tail -f
|
||
alias lessf="less +F"
|
||
|
||
# List all files colorized in long format
|
||
alias l="eza -G --icons"
|
||
alias ll="eza -l --icons"
|
||
alias la="eza -la --icons"
|
||
alias lg="eza -lG --icons"
|
||
alias lall="eza -lahF --icons --git"
|
||
alias lalg="eza -laGhF --icons --git"
|
||
alias latree="eza -laGghHT --git --icons"
|
||
alias lsd="eza -laD" # only dirs
|
||
|
||
# Enable aliases to be sudo’ed
|
||
alias sudo='sudo '
|
||
|
||
# Get week number
|
||
alias week='date +%V'
|
||
|
||
# Stopwatch
|
||
alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date'
|
||
|
||
# Dice for the undecided
|
||
alias dice='echo $[ 1 + $RANDOM % 6 ]'
|
||
alias d20='echo $[ 1 + $RANDOM % 20 ]'
|
||
|
||
# IP addresses
|
||
alias myip="dig +short myip.opendns.com @resolver1.opendns.com"
|
||
alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'"
|
||
|
||
# Canonical hex dump; some systems have this symlinked
|
||
command -v hd > /dev/null || alias hd="hexdump -C"
|
||
|
||
# URL-encode strings
|
||
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'
|
||
|
||
# Ring the terminal bell
|
||
alias ding="tput bel"
|
||
|
||
# Intuitive map function
|
||
# For example, to list all directories that contain a certain file:
|
||
# find . -name .gitattributes | map dirname
|
||
alias map="xargs -n1"
|
||
|
||
# Reload the shell (i.e. invoke as a login shell)
|
||
alias reload="exec $SHELL -l"
|
||
|
||
alias pp="prettyping 1.1.1.1"
|
||
|
||
alias path='echo -e ${PATH//:/\\n}' #Print each PATH entry on a separate line
|
||
# get top process eating memory
|
||
alias psmem='ps -e -orss=,args= | sort -b -k1 -nr'
|
||
alias psmem10='ps -e -orss=,args= | sort -b -k1 -nr | head -10'
|
||
# get top process eating cpu if not work try excute : export LC_ALL='C'
|
||
alias pscpu='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr'
|
||
alias pscpu10='ps -e -o pcpu,cpu,nice,state,cputime,args|sort -k1,1n -nr | head -10'
|
||
# top10 of the history
|
||
alias hist10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'
|
||
alias please='sudo !!'
|
||
alias gitup='for dir in $(find . -name ".git"); do cd ${dir%/*}; pwd ; git pull ; cd -; done'
|
||
|
||
# Default xclip to use Ctrl-c/Ctrl-v clipboard
|
||
alias xclip="xclip -selection c"
|
||
alias mirrorup='sudo reflector --verbose -c Poland -c Germany -c France -l 25 -a 2 -p https --sort rate --save /etc/pacman.d/mirrorlist'
|
||
alias lock="swaylock --screenshots --clock --indicator --indicator-radius 100 --indicator-thickness 7 --effect-blur 7x5 --effect-vignette 0.5:0.5 --ring-color bb00cc --key-hl-color 880033 --line-color 00000000 --inside-color 00000088 --separator-color 00000000 --grace 2 --fade-in 0.2"
|