#!/bin/bash
echo "*********Shell Script Assignment*********"
echo "****************************************"
echo "Welcome to 2023, by User:$(whoami)"
echo "Today is: "
date | awk '{print $1 "/" $2 "/" $3}'
echo "Time is:"
date | awk '{print $4}'
echo "****************************************"
echo "Server Uptime is:"
uptime
echo "Top $1 Last logins:"
last -a | head -$1
echo "****************************************"
echo "My Server Disk Utilization:"
df -h | xargs | awk '{print "Free Disk Space is:" $11 }'
df -h | xargs | awk '{print "Total Disk Space is:" $9 }'
echo "****************************************"
echo "My Server RAM(Memory) Utilization:"
free -h | xargs | awk '{print "Free Memory is:" $10}'
free -h | xargs | awk '{print "Total Memory is:" $8}'
echo "****************************************"
echo "Top $2 CPU Processes running:"
top -b | head -$2
echo "****************DEV****************"
Explanation:
Output:
Thank you!