You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
975 B
Bash

#!/bin/bash
export LC_ALL=C bash
tHost="$(hostname)"
tTime="$(date +"%d/%m/%Y a las %H:%M:%S")"
tMemTotal="$(free -m | grep "Mem:" | awk '{print $2}')"
tMemUsed="$(free -m | grep "Mem:" | awk '{print $3}')"
tMemFree="$(free -m | grep "Mem:" | awk '{print $4}')"
tLoadAverage="$(uptime | rev | cut -d ":" -f 1 | rev | cut -d " " -f 2-10)"
echo -e "\n$tHost - $tTime"
echo -e "RAM: $tMemUsed M usados de $tMemTotal M totales ($tMemFree M libres)\nCPU Load Average: $tLoadAverage\n\n[+] Listado de Procesos top10 consumo de RAM:\n"
ps -A --sort=-rss --format pid,user,pmem,rss,comm | head -10
echo -e "\nPor tanto el proceso en el top1 consumo RAM es:\n"
ps -A --sort=-rss --format pid,user,pmem,rss,command | head -2
echo -e "\n[+] Listado de Procesos top10 consumo CPU:\n"
ps -A --sort=-pcpu --format pid,user,pcpu,rss,comm | head -10
echo -e "\nPor tanto el proceso en el top1 consumo CPU es:\n"
ps -A --sort=-pcpu --format pid,user,pcpu,rss,command | head -2
echo -e "\n"