# Hard Drive usage function hddtop() { df -TPh \ | grep '^/dev' \ | grep -v squashfs \ | sort -k 6,6 -n \ | awk \ -v red="$(tput setaf 1)" \ -v yellow="$(tput setaf 3)" \ -v green="$(tput setaf 2)" \ -v reset="$(tput sgr0)" \ '{printf OFS"%s %s %s %s %s %s %s %s %s\n", \ (+$6>90)?red:(+$6>80?yellow:green),$1,$2,$3,$4,$5,$6,$7,reset \ }' \ | column -t } # List all ip's v4 # # OLD #ip4all () { # ip -4 -o addr \ # | grep -v 127.0.0 \ # | awk -v blue="$(tput bold;tput setaf 4)" -v reset="$(tput sgr0)" '{printf "%s\t%s\t%s %s %s\n",$2,":",blue,$4,reset}' #} # # NEW function ip4all() { echo -e "\033[32mInterfaces and IP\033[00m :" # Search all interfaces LISTE_INTERFACES=$(ip -4 a s|grep -P '^[0-9]+'|grep -v '^1:'|awk -F: '{print $2}'|sed 's/@.*//') # For all interfaces, get all ip's for INTERFACE in $LISTE_INTERFACES do echo -e "\t- \033[33m$INTERFACE\033[00m" ip -4 a s $INTERFACE |grep inet|awk '{print "\011\011" $2}' done } # Show top usage memory function memtop () { ps -eo size,pid,user,command --sort -size \ | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x <=NF ;x++ ) { printf("%s ",$x) } print ""}' \ | cut -d "" -f2 \ | cut -d "-" -f1 \ | head -20 }