Day 5 - Advance Linux Shell Scripting

Day 5 - Advance Linux Shell Scripting

1-Write a bash script create directories. sh that when the script is executed with three given arguments (one is the directory name and second is the start number of directories and third is the end number of directories ) it creates a specified number of directories with a dynamic directory name.

Create a Script to backup all your work done till now.

3-Read About Cron and Crontab, to automate the backup Script

Cron is an effective and popular command-line utility used to schedule tasks at a specified time and day without user interaction.
The scheduled tasks are known as cron jobs while the crontab is the list of the file containing the cron jobs.
Crontab is useful to perform various operations such as handling automated backups, rotating log files, syncing files between remote machines and clearing out temporary folders, etc.

The crond daemon is the background service that enables cron functionality.

Linux Crontab Syntax
* USER_NAME COMMAND/SCRIPT-TO-EXECUTE
│ │ │ │ │
│ │ │ │ │
│ │ │ │ |_________ Day of Week (0 – 6) (0 is Sunday, or use names)
│ │ │ |____________ Month (1 – 12),* means every month
│ │ |______________ Day of Month (1 – 31),* means every day
│ |________________ Hour (0 – 23),* means every hour
|___________________ Minute (0 – 59), * means every minute

  • crontab -e: Edit crontab file, or create one if it doesn’t already exist.

  • crontab -l: Display crontab file contents.

  • crontab -r: Remove your current crontab file.

  • crontab -i: Remove your current crontab file with a prompt before removal.

  • crontab -u <username>: Edit other user crontab files. This option needs system administrator privileges.

4-Read about User Management

User management in Linux is the process of creating, modifying, and deleting user accounts on a Linux system. In Linux, each user has a unique username and password, which are used to log in and access the system.we can set different permissions for different users in LINUX

adduser: add a user to the system.
passwd: set password fro user
userdel: delete a user account and related files.
addgroup: add a group to the system.
delgroup: remove a group from the system.
usermod: modify a user account.
sudo: run one or more commands as superuser permissions.

5-Create 2 users and just display their Usernames

Thankyou for reading!! many more in a queue

~Nikunj Kishore Tiwari

Great initiative by the #trainwithshubham community. Thank you Shubham Londhe for Guiding Us.

#devops #90daysofdevops #allaboutdevops #linux