Created
January 23, 2021 15:19
-
-
Save WillCQ97/1e9b3ab43f9512ab48e718b77e87ec7d to your computer and use it in GitHub Desktop.
Script que exibe algumas informações do sistema.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Autor desconhecido | |
#!/bin/bash | |
if test $# -ne 1; | |
then | |
echo "Comandos Disponíveis: cpu, mem ou disk" | |
echo use: $0 comando | |
exit 1 | |
fi | |
cpu=$(cat /proc/cpuinfo | grep "model name" | head -n1 | cut -d : -f 2) | |
freq=$(cat /proc/cpuinfo | grep "cpu MHz" | head -n1 | cut -d : -f 2) | |
memt=$(cat /proc/meminfo | grep "MemTotal" | cut -d: -f 2) | |
memf=$(cat /proc/meminfo | grep "MemAvailable" | cut -d: -f 2) | |
#cat /proc/crypto | |
#cat /proc/version ou version_signature | |
#Cat /proc/interruptions | |
#modules; locks | |
disco=$(df -h | awk '{ | |
if($NF == "/") | |
{ | |
print "Tamanho do Disco: " $2"B" | |
print "Usado: " $3"B" | |
print "Disponível: " $4"B" | |
print "% de Uso: " $5 | |
} | |
}' | |
) | |
case "${1^^}" in | |
CPU*) | |
echo -e "CPU:$cpu\nFreq:$freq Mhz" | |
;; | |
MEM*) | |
echo -e "Memória Total:$memt" | |
echo -e "Memória Livre:$memf" | |
;; | |
DISK*) | |
echo "$disco" | |
;; | |
*) | |
echo "Parâmetro desconhecido!" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment