Hackonology Forums
BASH Script to Display the System Information - Printable Version

+- Hackonology Forums (https://hackonology.com/forum)
+-- Forum: Technology & Configuration (https://hackonology.com/forum/forumdisplay.php?fid=3)
+--- Forum: Computer Tricks & Tips (https://hackonology.com/forum/forumdisplay.php?fid=7)
+--- Thread: BASH Script to Display the System Information (/showthread.php?tid=148)



BASH Script to Display the System Information - SysAdmin - 01-28-2021

Let us create a simple BASH script that provides information regarding your Linux system which includes:
  • [b]Active Users[/b]
  • [b]Uptime[/b]
  • [b]Load average[/b]
  • [b]Free and Used Memory[/b]
  • [b]Disk Space Utilization[/b]
Shell Script:

#!/bin/bash
clear
echo “This information is brought to you by $0.”

#Welcome the user
echo “Welcome, $USER”
echo
echo “Today is `date`.”
echo

#Currently active users.
echo “Following users are presently active:”
w | cut -d ' ' -f 1 | grep -v USER | sort -u
echo

#System information using uname command
echo “This is `uname -s` running on a `uname -m` processor.”
echo

#Information of uptime
echo “Following is the uptime information:”
uptime
echo

#Showing free memory
echo “Memory Details:”
free
echo

#Disk space usage using df command
echo “Disk Space Utilization:”
df -mh
echo