Computer

Crontab Examples

On Linux, Crontab is a text file with different content than usual. Each Linux user has a folder with that name, whose file contains a list of the scripts and commands that can be executed by that user.

Related Articles

With the commands we can do several actions automatically (schedule tasks), in the background.

If you have enough knowledge to create scripts, it is in the crontab folder where they will be saved. To create this file you will have to execute the command “crontab”.

Crontab examples

Here are some programs that can be stored in crontab files and tasks that can be performed with the command of the same name.

  • #! / bin / bash

Example #script

#sudo ls -l /> ResultFile

#chmod ugo + x query.sh

  • crontab file / replace an existing file with another specified by the user
  • crontab -e / edit existing file
  • crontab -l / list saved tasks in user crontab
  • crontab -d / delete created crontab
  • crontab -c dir / to handle your own crontab
  • crontab -u user / to handle the crontab of other users
  • #! / bin / bash

#script update example

#choose your distribution

# debian-ubuntu

# apt-get update & apt-get -y upgrade

#fedora

#yum -y update

#Arch

#pacman –noconfirm -Syu

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button