Shell script that take info about linux system like logged users, uptime, load average, free memory, disk usage. Script helps to see all info about system in a second. Administrator can modify the script bit ,if it requires to find system information from multiple server. Script run commands w, uname, uptime, free and df. From the uptime command script take load average.
#just echo welcome messages
echo "This is information provided by $0 . Program starts now."
echo "Hello, $USER"
#print today's date
echo "Today's date is `date`, this is week `date +"%V"`."
#list of currently loged user via w command.
echo "These users are currently connected:"
w | cut -d " " -f 1 - | grep -v USER | sort -u
#info about system with command uname and keys -m and -s
echo "This is `uname -s` running on a `uname -m` processor."
#info about uptime, using uptime command
echo "This is the uptime information:"
#info about free memory via free command
echo "Free memory:"
#info about disk usage
echo "Disk usage:"
Below is the script output.
This is information provided by ./system_info.sh . Program starts now.
Today's date is Sunday, March 3 2013 22:31:43 +0200, this is week 09.
These users are currently connected:
This is Linux running on a i686 processor.
This is the uptime information:
22:31:43 up 1:24, 2 users, load average: 0.45, 0.18, 0.07
total used free shared buffers cached
Mem: 3374792 1589476 1785316 0 96720 725652
-/+ buffers/cache: 767104 2607688
Swap: 4192924 0 4192924
Filesystem Size Used Avail Use% mounted
/dev/sda1 42G 5,5G 35G 14% /
tmpfs 1,7G 0 1,7G 0% /lib/init/rw
udev 1,7G 168K 1,7G 1% /dev
tmpfs 1,7G 160K 1,7G 1% /dev/shm
/dev/sda6 184G 26G 149G 15% /home
You might also like
Filed Under : SHELL SCRIPTS