My useful system information script for any Linux user who wants quick system information.

This is a system information script I am working on. This shows some useful information about your Linux system.

#!/bin/bash

echo "          My System information script."
echo " "
echo " "

echo "The computer has: $(awk < /proc/meminfo '{ if ($1 == "MemTotal:")
 { print $2 }}') Kilobytes of RAM."
echo "The kernel version is: $(uname -r)."
echo "There is: $(df -Hla / | awk '/dev/ {print $3 " remaining of",$4 " \
on the / partition."}')"
echo "The load average is: $(cut -f1 -d ' ' /proc/loadavg). The CPU has\
 $(grep -c ^processor /proc/cpuinfo 2>/dev/null) cores."
echo "Current CPU usage is: $(top -bn 2 -d 0.01 | grep '^%Cpu' | 
tail -n 1 | awk '{print $2+$4+$6}')%"
echo "There are $(ls /var/cache/apt/archives/ | wc -l) packages in the /var/cache/apt/archives/ directory."

This is what the output looks like.

          My System information script.
 
 
The computer has: 3715012 Kilobytes of RAM.
The kernel version is: 3.13.0-15-generic.
There is: 19G remaining of 53G on the / partition.
The load average is: 0.31. The CPU has 4 cores.
Current CPU usage is: 20%
There are 683 packages in the /var/cache/apt/archives/ directory.

This would be a useful script to put into your .bashrc and see the information every time you load a terminal window. Ubuntu server has a script that displays system information, there is some information about this here: http://askubuntu.com/questions/7949/where-does-the-system-information-information-come-from-on-login.

No comments have been made. Use this form to start the conversation :)

Leave a Reply