How to Use “crontab” Command in Linux [10 Practical Examples] | LinuxSimply

Опубликовано: 18 Октябрь 2024
на канале: LinuxSimply
141
3

💡 Elevate your Linux skills with our latest course ‘Linux Fundamentals: A Complete Guide for Beginners’. Start learning today: https://www.udemy.com/course/linux-fu...

Want to learn how to automate your tasks for productivity ? The crontab is there to help you. Unleash the power of scheduled tasks with the "crontab" command in Linux! Whether you're a system administrator, developer, or Linux enthusiast, this video is your comprehensive guide to mastering "crontab" with 10 practical examples.

The crontab command in Linux is the abbreviation for “Cron Table”. It is used for scheduling tasks at regular intervals. You can add your desired commands/scripts to crontab files by creating an editing session. The listed jobs in the crontab files are run by the cron daemon at predefined times.

💡 Key Topics Covered:
Understand the basics of crontab command, crontab command syntax and its options.
Learn how to edit and view the crontab files.
Learn how to remove crontab tasks.
Learn how to display confirmation message before removing crontab tasks.
Learn how to schedule a job every minute.
Learn how to schedule a job for a certain time period.
Learn how to run a task after each reboot.

Embark on an exploration into Linux mastery, delving deep into the crontab command! Effortlessly transform your task automation skills with a fresh and innovative approach. Subscribe now to immerse yourself in a comprehensive learning experience that will reshape your Linux skills.

Content Index
0:00 Introduction
0:16 What is crontab Command ?
1:00 Example 1: Editing Crontab Files
1:35 Example 2: Editing Crontab Files of Specified User
2:15 Example 3: Viewing Crontab Entries
2:41 Example 4: Viewing Crontab Entries of Specified User
3:10 Example 5: Removing Crontab Tasks
3:45 Example 6: Removing Crontab Tasks of Specified User
4:27 Example 7: Display Confirmation Message Before Removing Crontab Tasks
4:58 Example 8: Scheduling a Job for Every Minute
6:29 Example 9: Scheduling a Task for a Certain Time Period
7:34 Example 10: Running a Task After Each System Startup/Reboot

Instructor Details
Fahmid Bin Kibria
https://linuxsimply.com/fahmid-bin-ki...

Editor Details
Reshma Raj
https://linuxsimply.com/reshma-raj/

Article Link
The “crontab” Command in Linux [10 Practical Examples]
https://linuxsimply.com/crontab-comma...

Commands Used
-------------------------------
Example 1: Editing Crontab Files
crontab -e

Example 2: Editing Crontab Files of Specified User
sudo crontab -u fahmid -e

Example 3: Viewing Crontab Entries
crontab -l

Example 4: Viewing Crontab Entries of Specified User
sudo crontab -u fahmid -l

Example 5: Removing Crontab Tasks
crontab -r
crontab -l

Example 6: Removing Crontab Tasks of Specified User
sudo crontab -u fahmid -r

Example 7: Display Confirmation Message Before Removing Crontab Tasks
crontab -i -r

Example 8: Scheduling a Job for Every Minute
crontab -e
* * * * echo "1 Minute passed! Date & Time: $(date)" (double forward angled bracket) cron.log
cat cron.log

Example 9: Scheduling a Task for a Certain Time Period Using the “crontab” Command in Linux
crontab -e
10-20 * * * * echo "10-20 minutes of every hour: $(date)" (double forward angled bracket) new.log

Example 10: Running a Task After Each System Startup/Reboot
crontab -e
@reboot echo "1 line at each reboot. Date: $(date)" (double forward angled bracket) eachReboot.txt
cat eachReboot.txt

Follow Us
Facebook:   / softeko.linuxsimply  
Twitter:   / linuxsimply  
LinkedIn:   / linuxsimply  
Tiktok:   / linuxsimply  

#linux
#linuxsimply
#linuxtutorial
#cronjob
#ubuntu
#command
#schedule