2018-05-30 01:03:27 +02:00
|
|
|
|
|
|
|
# Hard Drive usage
|
|
|
|
function hddtop() {
|
|
|
|
df -TPh \
|
2018-05-30 19:02:00 +02:00
|
|
|
| grep '^/dev' \
|
|
|
|
| grep -v squashfs \
|
2018-05-30 01:03:27 +02:00
|
|
|
| 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
|
|
|
|
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}'
|
|
|
|
}
|
|
|
|
|
|
|
|
# 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
|
|
|
|
}
|