Skip to main content

Command Palette

Search for a command to run...

Linux Shell Scripting Mini Project(Server Resource Utilization Status)

Published
1 min read
Linux Shell Scripting Mini Project(Server Resource Utilization Status)
A

DevOps Enthusiast | AWS | Azure | Cloud | Linux | Git | Github | GCP | Docker | Kubernetes | VMware | Windows

Hello Everyone,

Today we will create the small shell script based on the below criteria,

✦ It will welcome the user with his/her username.

✦ It will show the date and time.

✦ It will show the uptime of the server and the last logins.

✦ It will show disk space utilization and RAM utilization.

✦ It will show the top 2 processes utilizing the high CPU.

Let's discuss the commands used in the script one by one.

1 -- To display the username I have used "whoami" command.

2 -- To display the date and time I have used "date" command.

3 -- To display the server uptime "uptime" command has been used.

4 -- To display the last login "last -a" command is used.

5 -- Below is the output for "df -H" command.

I have used the below command to get the available/total size.

6 -- I have used "free" as below to get the RAM utilization in available/total format.

7 -- "top | head -5" command has been used to get the top 2 high CPU utilizing processes.

Final Script:

Output:

P

Useful

1
A

Thank You.

S
Shaikh S3y ago

Appreciated !

1
A

Thank You.