I have a Debian box with some jobs scheduled using at. I know I can list the jobs with their times using atq, but is there any way to print out their contents, apart from peeking into /var/spool/cron/atjobs?

6 Answers 6


at -c jobnumber will list a single job. If you want to see all of them, you might create a script like

MAXJOB=$(atq | head -n1 | awk '{ print $1; }')
for each in $(seq 1 $MAXJOB); do echo "JOB $each"; at -c $each; done 

Probably there's a shorter way to do that, I just popped that out of my head :)

  • 8
    at -c $(atq | cut -f 1) or for each in $(atq | cut -f 1) will avoid "Cannot find jobid" errors. (Also, Bash has for ((each=1; each<=MAXJOB; each++)) so no need for seq. If you're concerned with portability, then #!/bin/sh.) Aug 26, 2010 at 15:08
  • don't forget good old awk, atq | awk '{ system("at -c " $1) }'
    – norcalli
    Apr 21, 2019 at 23:13

Building upon previous responses, this lists each job's line from atq showing job number and scheduled time and then just the command to be run, sorted chronologically (rather than job number):

for j in $(atq | sort -k6,6 -k3,3M -k4,4 -k5,5 |cut -f 1); do atq |grep -P "^$j\t" ;at -c "$j" | tail -n 2; done

producing, e.g.

48  Fri Mar 10 15:13:00 2017 a root

47  Fri Mar 10 15:14:00 2017 a root

A much simpler approach:

for j in $(atq | cut -f 1); do at -c "$j"; done

You could also look at each one in less in turn, which might be clearer:

for j in $(atq | cut -f 1); do at -c "$j" | less; done

I've created command atqc for this ("atq with command"). A bash function. Run this on the bash command line (terminal command). Or put it in the ~/.bashrc file to make it available for later:

atqc () { atq|perl -ne'($q,$j)=/((\d+).*)/;qx(at -c $j)=~/(marcinDEL\w+).\n(.*?)\n\1/s;print"$q $2"'; }

Test it:


That works for RHEL7 with at -V version 3.1.13.

Ubuntu 16.04 with at -V version 3.1.18 has a slightly different output format in at -c N, so on my Ubuntu server this works:

atqc(){ atq|perl -nE'($q,$j)=/((\d+).*)/;qx(at -c $j)=~/\n}\n(.*?)\s*$/s;say"$q: $1"';}

Here is an alternative approach, similar to the others in this thread but using awk more:

atq | awk '{ print "at -c " $1 }' | bash

To do a "dry run" and see what would be executed, simply remove the "| bash" part from the end.


I wanted to have my at jobs listed by execution date plus their corresponding command line. Swap the ## at line get_at_line if you prefer the output separated by blanks instead of columns.

me@PC3540:~$ which atl  
me@PC3540:~$ cat /home/me/bin/atl  
get_at_line () {  
for i in $(at -l | cut -f1 )  
 ATLINE=$(at -l | grep ^$i)  
 ATSTATUS=$(echo $ATLINE | tr -s " " | cut -f7 -d" ")  
 ATTIME=$(echo $ATLINE | cut -f2- | cut -f1-6 -d" ")  
 ATISO=$(date -d "$ATTIME" +%Y-%m-%d' '%R)  
 ATCMD=$(at -c $i | sed -n -e '/}/,$p' | grep -v -e '}' )    
 HEX=$(printf '%x\n' $i)   
 VAL=$(printf "%X\n" $((0x$PFIX+0x$HEX)))  
 echo Job: $(printf "%02d\n" $i) $VAL At: $ATISO $ATSTATUS: $ATCMD  
if $(which at > /dev/null)  
 if [ ! -z "$(at -l)" ]  
  get_at_line | sort -k5 -k6 | column -t -s" " -n  
  ##get_at_line | sort -k5 -k6  
  echo -e "\n.. no at jobs found for user $USER\n"  
 echo -e "\n.. service at not installed \n"  

You must log in to answer this question.

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