oneliners/alias/bash.aliases

56 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-08-23 18:19:17 +02:00
#!/bin/bash
# Collection of some useful bash-aliases
# ls
alias ll='ls -lahF --color=auto'
alias la='ls -Ah --color=auto'
alias l='ls -CF --color=auto'
# colorized output
alias ip='ip -c'
# mtr force curses interface if a graphical interface is present
alias mtr='mtr -t'
# less always with "ignore case". Alternatively, "LESS='-i'" can be used, but this breaks colored output in git-tools
alias less='less -i'
# ubuntu sysupgrade
alias aptup='sudo apt update && sudo apt upgrade && sudo apt autoremove'
# resolve own external ip
alias extip='dig +short myip.opendns.com @resolver1.opendns.com'
# lvresize including resize of supported FS in one go
alias lvrr='lvresize -r'
# without localization for readablity
alias free='LANG=c free'
alias man='LANG=c man'
# nicer view of mountpoints
alias nicemount='mount -t "$(grep -v '^nodev' /proc/filesystems | cut -f2 | paste -s -d ,)"'
# weather, does use geo-locate for approximation, otherwise append /city if incorrectly guessed
alias wetter='curl -s https://wttr.in/'
#############################################
# Collection of bash functions.
# $1, $2, $n are beeing set on time of sourcing, so they cannot be used in aliases, but in functions
# attach strace to already running PID
function latetrace { sudo strace -p $1 -e trace=write -e write=1,2; }
export -f latetrace
# topten history basecommands
function topten { history | awk '{ print $2 }' | sort | uniq -c | sort -rn | head ; }
export -f topten
# prints wifi SSID if connected. (needs to be reworked)
function showwifi { awk -F= '/^(psk|id)/{print $2}' /etc/NetworkManager/system-connections/"$(iwgetid -r)"; }
export -f showwifi