Manpages

CRONTAB(1) BSD General Commands Manual CRONTAB(1)

NAME

crontab — maintain crontab files for individual users

SYNOPSIS

crontab [-u user] [newtab]
crontab -l
[-u user]
crontab -r
[-i] [-u user]
crontab -e
[-u user]
crontab -s
crontab -t
line
crontab -T
crontab

DESCRIPTION

crontab lets users install, uninstall, view, and edit recurrent jobs in the crontab(5) format, as well as pre-view and convert them to systemd.timer(5) pairs. root may also spy on who which users have installed crontabs.

Each user may have their own crontab, but this can be limited by /etc/cron.allow to create an explicit allow-list or /etc/cron.deny to deny access to individual users.

Crontabs are checked before installing — if they are found to be invalid, installation is aborted and a summary of errors is written to the standard error stream.

OPTIONS
(by default)

replace the user’s crontab from newtab (standard input stream if "

- ", the default).
-l
, --list

Copy user’s crontab to the standard output stream, or error if there is none.

-r, --remove

Remove user’s crontab.

-i, --ask

Output a confirmation prompt before doing so.

-e, --edit

Let user edit crontab, install when they’re done.

-s, --show

List which users have a crontab installed. Nonexistent users are warned about to the standard error stream. Only root can do this.

-t, --translate

Validate and translate a crontab(5) line into a native systemd.timer(5) pair to the standard output stream.

-T, --test

Validate whether crontab is a valid crontab(5) file.

-u, --user=user

Edit user’s crontab instead of the currently-logged-in user’s. Only root can do this, and they should be careful about using crontab without this option — the current user is determined by $LOGNAME, $USER, $LNAME $USERNAME, and only then by the real UID!

FILES
/etc/cron.allow

If exists, only users listed here (one username per line) can install their own crontabs. Otherwise, everyone can.

/etc/cron.deny

Users listed here aren’t allowed to install their own crontabs.

/var/spool/cron/crontabs

Crontabs live here.

ENVIRONMENT

EDITOR, VISUAL, editor, vim, nano, and mcedit are tried, in order, when using -e.

SEE ALSO

crontab(5), systemd.cron(7) for a summary of the format and how to tweak installed cronjobs — systemctl edit cron-schedule.{timer|service}.

LIMITATIONS

SELinux is not supported.

systemd-cron 2.3.4-1 April 2, 2024 systemd-cron 2.3.4-1