Editing a cron job in Linux changes when an existing scheduled command runs without leaving an outdated schedule behind. Replacing the current entry instead of adding a second similar line keeps backup jobs, maintenance scripts, and report tasks on the intended cadence and avoids duplicate runs.

On current Linux systems, per-user cron schedules are usually edited with crontab -e. That command opens a temporary copy of the current user's crontab in the editor named by $VISUAL or $EDITOR when either variable is set, and saving the file installs the updated schedule automatically. A normal user crontab entry contains five time fields followed by the command.

Cron runs commands with a smaller environment than an interactive shell, so edited entries should keep absolute paths, explicit output redirection, and any variables such as MAILTO or PATH that the job depends on. If the job belongs to another account or lives in /etc/crontab or a file under /etc/cron.d, edit that owning schedule instead of copying the line into the current user's crontab because system cron files add a username field before the command.

Steps to edit a cron job in Linux:

  1. List the current user's crontab and identify the exact line that needs to change before opening the editor.
    $ crontab -l
    MAILTO=""
    0 5 * * * /usr/local/bin/backup.sh

    If the output says there is no crontab for the current account, use How to create a cron job in Linux instead of trying to edit a missing entry.

  2. Open the current user's crontab in the editor.
    $ crontab -e

    crontab -e uses the editor selected by $VISUAL or $EDITOR when those variables are set. If the wrong editor opens, use How to change the default editor in Linux before editing the job again.

  3. Replace only the cron line that needs to change and keep any environment lines that still apply.
    MAILTO=""
    30 6 * * 1-5 /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

    Use absolute paths and explicit output redirection when editing cron jobs because cron usually runs with a minimal shell environment.

  4. Save the file and exit the editor so crontab installs the updated entry automatically.

    If the editor closes without changing the temporary file, crontab keeps the existing schedule and may print No modification made instead of installing a new crontab.

    Replace the old line instead of leaving both the old and new schedules in the file, or the command will run twice.

  5. List the current user's crontab again and confirm the old line has been replaced.
    $ crontab -l
    MAILTO=""
    30 6 * * 1-5 /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1

    If the job belongs to another account, use sudo crontab -u username -e. If it lives in /etc/crontab or /etc/cron.d/job-name, edit that file with sudoedit and keep the extra username field that system cron files require.