Day 4: Practical Shell Scripting Challenges and Solutions

ยท

1 min read

Scenario 1: How to Write a Shell Script to Detect and Kill Zombie Processes

Step 1: Creating a shell script with name "killzpid.sh"

Step2: Creating a Shell Script Function to Identify and Terminate Zombie Processes

Step 3: Give executable permission to shell script file and then execute the shell script.

Scenario 2: Find the first 10 biggest files in the file system and write the output to a file.

Step 1: Create a shell script with name largestfile.sh

Step 2: Give executable permission to shell script file and then execute the shell script.

Scenario 3: Shell script to gracefully unmount a disk.

Step 1: I have create a mount point /mnt/data , to check how to create a mount point please check my LinkedIn post link. To check if the mount point is created perform lsblk command.

Step 2: Create the shell script

Step 3: Give executable permission to shell script and then execute it

ย