Suppose I had scheduled an at job to run 3 hours later:

$ echo command | at now +3 hours
$ atq
9     Mon Dec  5 14:00:00 2016 a nr

but having passed 1 hour I change my mind, and then need to run that specific job #9 from queue a immediately, that is, 2 hours earlier than the time at which it is scheduled to run.

How can I do it?

I know I can print the job command to stdout, copy and paste it to the command line, run it manually, and then remove job #9:

$ at -c 9
$ command
$ atrm 9

But this amounts to running another job, not #9 from queue a.

  • I think the answer is that you can't. I guess being able to reschedule a job without changing the job number isn't a very commonly requested feature. Dec 5, 2016 at 23:18
  • I see. Would it be possible to reschedule it, though?
    – n.r.
    Dec 6, 2016 at 1:01

2 Answers 2


There are two possibilities:

  • 2
    Thanks. Would you provide the link to the other answer, please?
    – n.r.
    Dec 21, 2016 at 1:23
  • I've seen the other answer, but I really love the simplicity of this one. Thank you. Jun 17, 2021 at 19:12

Based on the accepted answer, here is a convenient script (I call it atmv):


# Idea taken from here:
# https://unix.stackexchange.com/a/331789/68456

set -euo pipefail

atlist() { atq | sed 's/^/  /'; }

if [ $# -lt 2 ]; then
    echo "Syntax: atmv job_num new time arguments"
    exit 1


if [ "$(atq | cut -f 1 | grep "$job_num" | wc -l)" != "1" ]; then
    echo "Error: There is no job with number \"$job_num\"."
    echo "Pick one of these:"
    exit 2

at -c "$job_num" | at "$@" 2> /dev/null
atrm "$job_num"
echo "Done! This is the new list of at jobs:"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .