Sysinfo - Informações sobre o seu computador
Publicado por Denis Doria 11/07/2008
[ Hits: 7.138 ]
Exibe diversas informações sobre o sistema.
Exemplo:
sysinfo -m
[Memory]
Maximum Capacity: 4 GB
Number Of Devices: 2
Size: 1024 MB
Size: No Module Installed
MemTotal: 1002.62 MB
Mostra a capacidade máxima de memória do seu computador, o número
de slots, slots ocupados e o tamanho do pente, e o total da memória.
sysinfo -s
[System]
Manufacturer: Dell Inc.
Product Name: Latitude D630
Version: Not Specified
Serial Number: 3FFZJF1
Informações relevantes sobre o seu computador.
#!/bin/bash ########################################################################################## #Sysinfo - Get a lot of information about the system # #Version: 0.3 # #Author: Denis Doria de Oliveira Santos #E-mail: denisdoria@gmail.com #Date: 11/06/2008 ########################################################################################### #Version: 0.1 # # +Create all base system, with the functions that I need # ########################################################################################### #Version: 0.2 # # +Add getopts # +Add usage function # +Improved memory function # ########################################################################################### #Version: 0.3 # # + Improved os information, the os function was copied from hinventory_Linux.sh # all hinventory code can be find in http://sourceforge.net/projects/h-inventory/, # some modification was done from the original code. # +Improved memory function # -Removed hwmisc function # ########################################################################################### #Version: 0.4 # # + Created pci function # + Improved memory function # ########################################################################################### [ $(whoami) != 'root' ] && echo -e "\nJust root can run this script...\nSorry, but some commands just root could exec!\n" && exit 1 A=0 S=0 C=0 M=0 N=0 D=0 O=0 B=0 H=0 W=0 P=0 function network(){ #Catch all ips and interfaces #Captura todos os ips e suas interfaces echo "[Network]" ifconfig|fgrep inet|awk -F":| " '{print $13}'|\ while read LINHA; do if [ $LINHA ];then INTERFACE=$(ifconfig|fgrep -B1 $LINHA|cut -d' ' -f1); echo -e "$INTERFACE\\t$LINHA"; fi done echo "" lspci|fgrep Ethernet|cut -d' ' -f2- echo "" } function system(){ #Show information about system #Mostra informações do sistema echo "[System]" dmidecode |grep -A4 "System Information"|sed '1d'|tr -d '\t' echo "" } function memory(){ #Information about memory, number of slots and memory size #Informações sobre a memória, número de slots, tamanho da memória echo "[Memory]" dmidecode |sed -ne '/Physical Memory Array/,/Handle /p'|egrep '(Maximum Capacity|Number Of Devices)'|tr -d '\t' #dmidecode |grep -A5 "Memory Device$"|fgrep Size|tr -d '\t' #dmidecode|sed -n '/Memory Device$/,/Handle /p'|fgrep Size|tr -d '\t'| tee /dev/stderr |awk -F':| ' '{print $3}'|tr -d [:alpha:]|tr '\n' '+'|sed 's/+*$/\n/'|bc dmidecode|sed -n '/Memory Device$/,/Handle /p'|fgrep Size|tr -d '\t' echo "" sed -e '1!d' -e 's/..$//' -e 's/ //g' /proc/meminfo |awk -F: '{print $1": "$2/1024" MB"}' # fgrep MemTotal /proc/meminfo|awk -F':| ' '{print "Total Of Memory: "int($8/1024)}' echo "" } function cpu(){ #Information about processor #Infomações sobre o processador echo "[CPU]" dmidecode |sed -ne '/Processor Information/,/Handle/p' |sed -e '/\t\t\t/d' |tr -d '\t'|\ egrep '(Manufacturer:|Current Speed:|Family:|Socket Designation:)'|sed -e 's/\(MHz\)/\1\n/' -e 's/\(GHz\)/\1\n/' NUCLEOS=$(grep processor /proc/cpuinfo |wc -l) CHIPS=$(dmidecode |fgrep "Processor Information"|wc -l) NUCLEOS_POR_PROCESSADOR=$((NUCLEOS/CHIPS)) echo "Number of Processors: "$CHIPS echo "Core per Processor: "$NUCLEOS_POR_PROCESSADOR echo "" } function disk() { #Information about disks #Informações sobre os discos echo "[Disk]" fdisk -l 2> /dev/null|grep "Disk.*,"|cut -d, -f1 |\ while read LINHA do echo -e "${LINHA}\n" printf "%-9s%12s%12s\n" 'Device' 'Size' 'Type' &&\ fdisk -l 2> /dev/null|fgrep `echo $LINHA|awk -F" |:" '{print $2}'`|tr -d '*'|\ fgrep -v Disk|\ awk '{printf("%9s %10s MB %10s\n", $1,int($4/1024),$6)}' echo "" done echo "" } function swap(){ #Information about swap #Informação sobre o swap echo "[Swap]" fgrep dev "/proc/swaps"|awk '{print "Swap Particion: "$1"\nSwap Space: "int($3/1024)" MB"}' echo "" } function os (){ #Check the version and the distribution of Linux #Verifica a versão e a distribuição Linux NAME=`uname -s` if [ "$NAME" = "Linux" ] then if test -f /etc/redhat-release; then DISTRIBUTION="RedHat" RELEASE=`cat /etc/redhat-release` elif test -f /etc/redhat-version; then DISTRIBUTION="RedHat" RELEASE=`cat /etc/redhat-version` elif test -f /etc/fedora-release; then DISTRIBUTION="Fedora" RELEASE=`cat /etc/fedora-release` elif test -f /etc/mandrake-release; then DISTRIBUTION="Mandrake" RELEASE=`cat /etc/mandrake-release` elif test -f /etc/SuSE-release; then DISTRIBUTION="Novell SuSE" RELEASE=`cat /etc/SuSE-release` elif test -f /etc/debian_version; then DISTRIBUTION="Debian" RELEASE=`cat /etc/debian_version` elif test -f /etc/debian-version; then DISTRIBUTION="Debian" RELEASE=`cat /etc/debian-version` elif test -f /etc/arch-release; then DISTRIBUTION="Arch" RELEASE=`cat /etc/arch-release` elif test -f /etc/gentoo-release; then DISTRIBUTION="Gentoo" RELEASE=`cat /etc/gentoo-release` elif test -f /etc/slackware-release; then DISTRIBUTION="Slackware" RELEASE=`cat /etc/slackware-release` elif test -f /etc/slackware-version; then DISTRIBUTION="Slackware" RELEASE=`cat /etc/slackware-version` elif test -f /etc/yellowdog-release; then DISTRIBUTION="Yellow dog" RELEASE=`cat /etc/yellowdog-release` elif test -f /etc/sourcemage-release; then DISTRIBUTION="Source Mage" RELEASE=`cat /etc/sourcemage-release` elif test -f /etc/smgl.iso; then DISTRIBUTION="Source Mage" RELEASE=`cat /etc/smgl.iso` else DISTRIBUTION="unknown" RELEASE="unknown" fi echo "[Operating System]" echo "Hostname: $(hostname)" echo "Kernel Version: $(uname -r)" echo "Operating System: $NAME" echo "Distribution: $DISTRIBUTION" echo "Release: $RELEASE" echo "" fi } function hba(){ echo "[HBA]" lspci|fgrep "Fibre Channel"|cut -d' ' -f2- echo "" } function usage(){ echo -e '\t-a Show all information \t-s Show system information \t-c Show CPU information \t-m Show memory information \t-n Show network information \t-d Show disks information \t-w Show swap information \t-b Show HBA information \t-o Show Operating System information\n' } function all(){ os system cpu disk memory pci network swap hba } function pci(){ echo "[PCI]" dmidecode |sed -ne '/PCI/,/Handle /p'|egrep '(Current)'|tr -d '\t' echo "" echo "Total of PCI: `dmidecode |sed -ne '/PCI/,/Handle /p'|egrep '(Current)'|tr -d '\t'|wc -l`" echo "" } function sysinfo(){ [ $H -eq 1 ] && usage && exit 0 [ $A -eq 1 ] && all && exit 0 [ $S -eq 1 ] && system [ $C -eq 1 ] && cpu [ $M -eq 1 ] && memory [ $N -eq 1 ] && network [ $D -eq 1 ] && disk [ $W -eq 1 ] && swap [ $O -eq 1 ] && os [ $B -eq 1 ] && hba [ $P -eq 1 ] && pci exit 0 } while getopts 'aschmndwobp' OPT do case $OPT in a) A=1 #all ;; s) S=1 #system ;; c) C=1 #cpu ;; m) M=1 #memory ;; n) N=1 #network ;; d) D=1 #disk ;; w) W=1 #swap ;; o) O=1 #os ;; b) B=1 #hba ;; h) H=1 #usage ;; p) P=1 #pci ;; ?) usage && exit 1 ;; esac done sysinfo exit 0
Firewall Iptables agressivo para desktop
Update no-ip utilizando Shell Script
Adicionar/Deletar Usuarios Samba/Sistema
Compartilhando a tela do Computador no Celular via Deskreen
Como Configurar um Túnel SSH Reverso para Acessar Sua Máquina Local a Partir de uma Máquina Remota
Configuração para desligamento automatizado de Computadores em um Ambiente Comercial
Como renomear arquivos de letras maiúsculas para minúsculas
Imprimindo no formato livreto no Linux
Vim - incrementando números em substituição
Efeito "livro" em arquivos PDF
Como resolver o erro no CUPS: Unable to get list of printer drivers
Não to conseguindo resolver este problemas ao instalar o playonelinux (1)
Excluir banco de dados no xampp (1)
[Python] Automação de scan de vulnerabilidades
[Python] Script para analise de superficie de ataque
[Shell Script] Novo script para redimensionar, rotacionar, converter e espelhar arquivos de imagem
[Shell Script] Iniciador de DOOM (DSDA-DOOM, Doom Retro ou Woof!)
[Shell Script] Script para adicionar bordas às imagens de uma pasta