Arch Linux Info Script

I wrote this script because I’m on so many different Arch machines, sometimes it’s hard to keep track :) Plus, it gives me a handy way to find all of my information I’m looking for with one simple command. It outputs something like this:

[davec@Arch64 ~]$ info
 
ARCH LINUX - Machine Information Script ver .10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DATE: 05/20/09 03:18:06 PM   MACHINE NAME: Arch64
 
Eth0: Local IP:10.1.1.65  Bcast:10.1.1.255  Mask:255.255.255.0
ETHERNET CARD: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev 01)
CPU INFO: Qty=1 x86_64 Quad-Core AMD Opteron(tm) Processor 2384
VIDEO CARD: VMware Inc Abstract SVGA II Adapter
AUDIO CONTROLLER:
RAM INFO: 1026860 kB
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.1.1.0        *               255.255.255.0   U     0      0        0 eth0
default         10.1.1.254      0.0.0.0         UG    0      0        0 eth0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DISK USAGE:
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             9.7G  2.8G  6.5G  30% /
none                  502M     0  502M   0% /dev/shm
/dev/sda1              38M  9.8M   27M  27% /boot
/dev/sda4             9.8G  151M  9.2G   2% /home
jughead:/vol/vol1_isp/vusers
                      675G  492G  184G  73% /var/users
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
UPTIME:  15:18:06 up 1 day, 22:26,  2 users,  load average: 0.00, 0.00, 0.00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DAEMONS=(syslog-ng network portmap nfslock @netfs @crond @sshd @mysqld @httpd @vmware-tools)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Here’s the script. Originally it was much larger, and the output was as well, but this actually shows me pretty much most of what I need on a day to day basis, I can look for the rest as I need it :)

[davec@Arch64 ~]$ type info
info is hashed (/usr/bin/info)
[davec@Arch64 ~]$ less /usr/bin/info
-------------------------------------
 
#!/bin/bash
# by Crouse - usalug.org 09-12-2007
clear
num_cpus=`cat /proc/cpuinfo | grep -c "model name"`
machine_cpu=`cat /proc/cpuinfo | grep -m 1 "model name" | cut -d: -f2`
machine_mhz=`cat /proc/cpuinfo | grep -m 1 "cpu MHz" | cut -d: -f2`
machine_cpuinfo=`uname -mp`
todays_date=`date +"%D %r"`
machine_uptime=`uptime`
machine_ram=`cat /proc/meminfo | grep -m 1 "MemTotal:" | cut -d: -f2 |  sed 's/^[ \t]*//'`
machine_video=`lspci | grep -m 1 "VGA" | cut -d: -f3 |  sed 's/^[ \t]*//'`
machine_eth_card=`lspci | grep -m 1 "Ethernet" | cut -d: -f3 |  sed 's/^[ \t]*//'`
machine_audio_controller=`lspci | grep -m 1 "audio" | cut -d: -f3 |  sed 's/^[ \t]*//'`
arch_damons=`grep "DAEMONS=" /etc/rc.conf `
last_logins=`last | head`
eth0info=`ifconfig eth0 | grep "inet addr:" | sed 's/inet addr/Local IP/g' | sed 's/^[ \t]*//;s/[ \t]*$//'`
 
echo "ARCH LINUX - Machine Information Script ver .10"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "DATE: $todays_date   MACHINE NAME: $HOSTNAME  "
echo " "
echo "Eth0: $eth0info"
echo "ETHERNET CARD: $machine_eth_card"
echo "CPU INFO: Qty=$num_cpus $machine_cpuinfo"
echo "VIDEO CARD: $machine_video"
echo "AUDIO CONTROLLER: $machine_audio_controller"
echo "RAM INFO: $machine_ram"
echo " "
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
route
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "DISK USAGE:"
df -h
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "UPTIME: $machine_uptime"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
# echo "LAST LOGINS:"; echo $last_logins
# echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
echo "$arch_damons"
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"

One Comment

  1. emallson says:

    Ya’know? This would make a nice portion of a conky display