Advanced Linux Shell Scripting for DevOps

Advanced Linux Shell Scripting for DevOps

ยท

2 min read

Table of contents:
๐Ÿ“Œ Task - 1: Create Multiple Directories by Passing Arguments ๐Ÿ“๐Ÿ“
๐Ÿ“Œ Task - 2: Script to Backup Your Work ๐Ÿ“œ๐Ÿ’พ
๐Ÿ“Œ Task - 3: What are Cron and Crontab ๐Ÿ•ฐ๏ธ๐Ÿ—’๏ธ
๐Ÿ“Œ Task - 4: User Management in Linux ๐Ÿ‘ฅ๐Ÿ”ง
๐Ÿ“Œ Task - 5: Creating Users and Displaying Usernames ๐Ÿ‘ค๐Ÿ‘ค

๐Ÿ“ Introduction

This blog will cover the automation of creating multiple directories, the process of taking backups using cron jobs, and the management of users in Linux.

๐Ÿ“Œ Task - 1 Create Multiple Directories by Passing Arguments ๐Ÿ“๐Ÿ“

๐Ÿ“Œ Task - 2 Script to Backup Your Work ๐Ÿ“œ๐Ÿ’พ

Output:

๐Ÿ“Œ Task - 3 What are Cron and Crontab ๐Ÿ•ฐ๏ธ๐Ÿ—’๏ธ

The crontab is a list of commands that you want to run on a regular schedule, and also the name of the command used to manage that list. It allows users to schedule tasks or commands to run at specific intervals or at predefined times. These scheduled tasks are referred to as corn jobs.

  • View Root Crontab entries : Login as root user (su โ€“ root) and do crontab -l.

  • To view crontab entries of other Linux users : Login to root and use -u {username} -l.

  • To edit a crontab entries, use crontab -e. By default this will edit the current logged-in users crontab.

Entry in the crontab file to schedule the above script for daily execution at 11:30. /dev/null This refers to the null device, and writing to it is a way to discard the output.

๐Ÿ“Œ Task - 4: User Management in Linux ๐Ÿ‘ฅ๐Ÿ”ง

User management in Linux involves creating, managing, and controlling user accounts on the system. Each user account represents a separate identity that can access the system's resources, files, and applications.

๐Ÿ“Œ Task - 5 Creating Users and Displaying Usernames ๐Ÿ‘ค๐Ÿ‘ค

ย