Streamline Your DevOps Workflow with an Automated Shell Scripting Mini Project !!!

Streamline Your DevOps Workflow with an Automated Shell Scripting Mini Project !!!

What is Shell Scripting?

A shell script is a text file that contains a sequence of commands for a UNIX-based operating system.

Now the question that comes into mind is Why do we use it?

Basically, it has many advantages like an easy program or file selection, quick start, and interactive debugging. A shell script can be used to provide a sequencing and decision-making linkage around existing programs.

How to do it?

  1. First of all, you have to make a file by using the vim editor.

  2. Then you have to use the shebang (#!) character sequence e.g. #!/bin/bash.

  3. After that, you can further write your commands as per your needs.

Now it's time to do some tasks (Mini-project) !!!

  1. In the first task, you have to print a welcome message.

  2. Then you have to print a greeting message with the name of that user.

  3. And after that, you have to check the uptime and login details of the server.

  4. Now in this task, you have to execute the commands to check the Disk space available and RAM utilization.

  5. In the end, you have to execute a command to check the top cpu processes.

List of the commands that are going to be used in the task :

  1. echo -e

  2. whoami

  3. uptime

  4. last -a

  5. df -h

  6. free

  7. top

  8. awk

  9. head

  10. xargs

These are the commands which are going to be used to complete the task.

Let's look at the result of every command :

$whoami

$uptime

$df -a

$free

now I'm going to show the script and their result as well.

Script :

Output :

Conclusion :

In conclusion, mastering shell scripting can greatly enhance your productivity as a developer, system administrator, or power user. With the right knowledge and tools, you can automate tedious tasks, streamline complex workflows, and unlock the full potential of your command line interface. So, don't hesitate to dive deeper into the world of shell scripting and explore its endless possibilities. Happy scripting!

written by :

Utkarsh Pathak

Hello, lovely people! This is Utkarsh, and I am passionate about DevOps. I have embarked on a journey to share my experience with all of you through my beginner-friendly blog. My articles will cover everything from the concepts I have learned to the projects I have built and the tasks I perform related to DevOps. Let's learn and grow together!

Connect me :

Linkedin