CPU
top -l 1 | awk '/CPU usage/ {print "CPU Usuario: " $3 " "}';
top -l 1 | awk '/CPU usage/ {print "CPU Sistema: " $5 " "}';
top -l 1 | awk '/CPU usage/ {print "CPU Libre: " $7 " "}';
RAM
top -l 1 | awk '/PhysMem/ {print "RAM Usada: " $8 " "}' ;
top -l 1 | awk '/PhysMem/ {print "RAM Libre: " $10 " "}' ;
Procesos
ps -amcwwwxo "command %mem %cpu" | grep -v grep | head -6
IPs
myen0=`ifconfig en0 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "$myen0" != "" ]
then
echo "Ethernet : $myen0"
else
echo "Ethernet : INACTIVE"
fi
myen1=`ifconfig en1 | grep "inet " | grep -v 127.0.0.1 | awk '{print $2}'`
if [ "myen1" != "" ]
then
echo "AirPort : $myen1"
else
echo "Airport : INACTIVE"
fi
inetip=$(curl -s http://checkip.dyndns.org/ | sed 's/[a-zA-Z<>/ :]//g')
if [ "$inetip" = "" ]; then inetip="offline"; fi
External IP: $inetip
Hora
date "+%H:%M"
Mes
date "+%B"
Dia (Numero)
date +%d
Dia (Letras)
date +%A
Porcentaje HDD
df -h | grep 'disk0s2' | awk '{print $5}'
Circulo Capacidad HDD
Se descarga desde http://www.macosxtips.co.uk/geeklets/system/disk-capacity-meter/
Power
my_ac_adapt=`ioreg -w0 -l | grep ExternalConnected | awk '{print $5}'`
if [ "$my_ac_adapt" == "Yes" ]
then
echo "Power : Externo"
else
cur_power=`ioreg -w0 -l | grep CurrentCapacity | awk '{print $5}'`
max_power=`ioreg -w0 -l | grep MaxCapacity | awk '{print $5}'`
bat_percent=`echo "scale=2;$cur_power / $max_power" | bc`
bat_percent=`echo "$bat_percent * 100" | bc | sed 's/.00//'`
cyc_count=`ioreg -w0 -l | grep "Cycle Count" | awk 'BEGIN { FS = "=" } ; {print $8}' | awk 'BEGIN { FS = "}" } ; {print $1}'`
echo "Power : Bateria ($bat_percent%)"
fi