The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


at - execute commands at a later time


at [-m][-f file][-q queuename] -t time

at [-m][-f file][-q queuename] timespec ...

at -r at_job_id ...

at -l -q queuename

at -l [at_job_id ...]


The at utility reads commands from standard input and groups them together as an at-job , to be executed at a later time.

The at-job will be executed in a separate invocation of the shell, running in a separate process group with no controlling terminal, except that the environment variables, current working directory, file creation mask and other implementation-dependent execution-time attributes in effect when the at utility is executed will be retained and used when the at-job is executed.

When the at-job is submitted, the at_job_id and scheduled time are written to standard error. The at_job_id is an identifier that will be a string consisting solely of alphanumeric characters and the period character. The at_job_id is assigned by the system when the job is scheduled such that it uniquely identifies a particular job.

User notification and the processing of the job's standard output and standard error are described under the -m option.

Users are permitted to use at if their name appears in the file /usr/lib/cron/at.allow. If that file does not exist, the file /usr/lib/cron/at.deny is checked to determine if the user should be denied access to at. If neither file exists, only a process with the appropriate privileges is allowed to submit a job. If only at.deny exists and is empty, global usage is permitted. The at.allow and at.deny files consist of one user name per line.


The at utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-f file
Specify the pathname of a file to be used as the source of the at-job, instead of standard input.
(The letter ell.) Report all jobs scheduled for the invoking user if no at_job_id operands are specified. If at_job_ids are specified, report only information for these jobs. The output will be written to standard output.
Send mail to the invoking user after the at-job has run, announcing its completion. Standard output and standard error produced by the at-job will be mailed to the user as well, unless redirected elsewhere. Mail will be sent even if the job produces no output. If -m is not used, the job's standard output and standard error will be provided to the user  by means of mail,  unless they are redirected elsewhere; if there is no such output to provide, the implementation need not notify the user of the job's completion.
-q queuename
Specify in which queue to schedule a job for submission. When used with the -l option, limit the search to that particular queue. By default, at-jobs will be scheduled in queue a. In contrast, queue b is reserved for batch jobs. (See the batch utility.) The meanings of all other queuenames are implementation-dependent.
Remove the jobs with the specified at_job_id operands that were previously scheduled by the at utility.
-t time
Submit the job to be run at the time specified by the time option-argument, which must have the format as specified by the touch utility.


The following operands are supported:
The name reported by a previous invocation of the at utility at the time the job was scheduled.
Submit the job to be run at the date and time specified. All of the timespec operands are interpreted as if they were separated by space characters and concatenated, and are parsed as described in the grammar at the end of this section. The date and time are interpreted as being in the timezone of the user (as determined by the TZ variable), unless a timezone name appears as part of time, below. In the POSIX locale, the following describes the three parts of the time specification string. All of the values from the LC_TIME categories in the POSIX locale are recognised in a case-insensitive manner.
The time can be specified as one, two or four digits. One- and two-digit numbers are taken to be hours, four-digit numbers to be hours and minutes. The time can alternatively be specified as two numbers separated by a colon, meaning hour:minute. An AM/PM indication (one of the values from the am_pm keywords in the LC_TIME locale category) can follow the time; otherwise, a 24-hour clock time is understood. A timezone name can also follow to further qualify the time. The acceptable timezone names are implementation-dependent, except that they will be case-insensitive and the string utc is supported to indicate the time is in Coordinated Universal Time. The time field can also be one of the following tokens in the POSIX locale:
Indicates the time 12:00 am (00:00).
Indicates the time 12:00 pm.
Indicate the current day and time. Invoking at <now> will submit an at-job for potentially immediate execution (that is, subject only to unspecified scheduling delays).

An optional date can be specified as either a month name (one of the values from the mon or abmon keywords in the LC_TIME locale category) followed by a day number (and possibly year number preceded by a comma) or a day of the week (one of the values from the day or abday keywords in the LC_TIME locale category). Two special days are recognised in the POSIX locale:
Indicates the current day.
Indicates the day following the current day.

If no date is given, today is assumed if the given time is greater than the current time, and tomorrow is assumed if it is less. If the given month is less than the current month (and no year is given), next year is assumed.

The optional increment is a number preceded by a plus sign (+) and suffixed by one of the following: minutes, hours, days, weeks, months or years. (The singular forms will be also accepted.) The keyword next is equivalent to an increment number of + 1. For example, the following are equivalent commands:

at 2pm + 1 week
at 2pm next week

The following grammar describes the precise format of timespec in the POSIX locale. The general conventions for this style of grammar are described in . This formal syntax takes precedence over the preceding text syntax description. The longest possible token or delimiter will be recognised at a given point. When used in a timespec, white space also delimits tokens.

%token hr24clock_hr_min
%token hr24clock_hour
  A hr24clock_hr_min is a one, two or four digit number.  A one or two
  digit number constitutes a hr24clock_hour.  A hr24clock_hour may be
  any of the single digits '0' - '9', or may be double digits, ranging
  from "00" - "23".  If a hr24clock_hr_min is a four digit number, the
  first two digits must be a valid hr24clock_hour, while the last two
  represent the number of minutes, from "00" - "59".

%token wallclock_hr_min
%token wallclock_hour
  A wallclock_hr_min is a one, two or four digit number.  A one or two
  digit number constitutes a wallclock_hour.  A wallclock_hour may be
  any of the single digits '1' - '9', or may be double digits, ranging
  from "01" - "12".  If a wallclock_hr_min is a four digit number, the
  first two digits must be a valid wallclock_hour, while the last two
  represent the number of minutes, from "00" - "59".

%token minute
  A minute is a one or two digit number whose values can be '0' - '9'
  or "00" - "59".

%token day_number
  A day_number is a number in the range appropriate for the particular
  month and year specified by month_name and year_number, respectively.
  If no year_number is given, the current year is assumed if the given
  date and time are later this year.  If no year_number is given and
  the date and time have already occurred this year and the month is
  not the current month, next year is the assumed year.

%token year_number
  A year_number is a four-digit number representing the year A.D., in
  which the at_job is to be run.

%token inc_number
  The inc_number is the number of times the succeeding increment
  period is to be added to the specified date and time.

%token timezone_name
  The name of an optional timezone suffix to the time field, in an
  implementation-dependent format.

%token month_name
  One of the values from the "mon" or "abmon" keywords in the LC_TIME
  locale category.

%token day_of_week
  One of the values from the "day" or "abday" keywords in the LC_TIME
  locale category.

%token am_pm
  One of the values from the "am_pm" keyword in the LC_TIME locale

%start timespec
timespec    : time
            | time date
            | time increment
            | time date increment
            | nowspec

nowspec     : "now"
            | "now" increment

time        : hr24clock_hr_min
            | hr24clock_hr_min timezone_name
            | hr24clock_hour ":" minute
            | hr24clock_hour ":" minute timezone_name
            | wallclock_hr_min am_pm
            | wallclock_hr_min am_pm timezone_name
            | wallclock_hour ":" minute am_pm
            | wallclock_hour ":" minute am_pm timezone_name
            | "noon"
            | "midnight"

date        : month_name day_number
            | month_name day_number "," year_number
            | day_of_week
            | "today"
            | "tomorrow"

increment   : "+" inc_number inc_period
            | "next" inc_period

inc_period  : "minute" | "minutes"
            | "hour" | "hours"
            | "day" | "days"
            | "week" | "weeks"
            | "month" | "months"
            | "year" | "years"


The standard input must be a text file consisting of commands acceptable to the shell command language described in Shell Command Language . The standard input will only be used if no -f file option is specified.


See the STDIN section.

The text files /usr/lib/cron/at.allow and /usr/lib/cron/at.deny contain user names, one per line, of users who are, respectively, authorised or denied access to the at and batch utilities.


The following environment variables affect the execution of at:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.
Determine the location of message catalogues for the processing of LC_MESSAGES .
Determine the format and contents for date and time strings written and accepted by at.
Determine a name of a command interpreter to be used to invoke the at-job. If the variable is unset or null, sh will be used. If it is set to a value other than a name for sh, the implementation will do one of the following: use that shell; use sh; use the login shell from the user database; or any of the preceding accompanied by a warning diagnostic about which was chosen.
Determine the timezone. The job will be submitted for execution at the time specified by timespec or -t time relative to the timezone specified by the TZ variable. If timespec specifies a timezone, it will override TZ . If timespec does not specify a timezone and TZ is unset or null, an unspecified default timezone will be used.




When standard input is a terminal, prompts of unspecified format for each line of the user input described in the STDIN section may be written to standard output.

In the POSIX locale, the following will be written to the standard output for each job when jobs are listed in response to the -l option:

"%s\t%s\n", at_job_id, <date> where <date> is equivalent in format to the output of:

date +"%a %b %e %T %Y"

The date and time written will be adjusted so that they appear in the timezone of the user (as determined by the TZ variable).


The following will be written to standard error when a job has been successfully submitted:

"job %s at %s\n", at_job_id, <date> where <date> has the same format as is described in the STDOUT section. Neither this, nor warning messages concerning the selection of the command interpreter, are considered a diagnostic that changes the exit status.

Diagnostic messages, if any, are written to standard error.






The following exit values are returned:
The at utility successfully submitted, removed or listed a job or jobs.
An error occurred.


The job will not be scheduled, removed or listed.


The format of the at command line shown here is guaranteed only for the POSIX locale. Other cultures may be supported with substantially different interfaces, although implementations are encouraged to provide comparable levels of functionality.

Since the commands run in a separate shell invocation, running in a separate process group with no controlling terminal, open file descriptors, traps and priority inherited from the invoking environment are lost.

Some implementations do not allow substitution of different shells using SHELL . System V systems, for example, have used the login shell value for the user in /etc/passwd. To select reliably another command interpreter, the user must include it as part of the script, such as:

$ at 1800
myshell myscript
job ... at ...


  1. This sequence can be used at a terminal:
    at -m 0730 tomorrow
    sort < file >outfile

  2. This sequence, which demonstrates redirecting standard error to a pipe, is useful in a command procedure (the sequence of output redirection specifications is significant):
    at now + 1 hour <<!
    diff file1 file2 2>&1 >outfile | mailx mygroup

  3. To have a job reschedule itself, at can be invoked from within the at-job. For example, this daily processing script named my.daily will run every day (although crontab is a more appropriate vehicle for such work):
    # my.daily runs every day
    daily processing
    at now tomorrow < my.daily

  4. The spacing of the three portions of the POSIX locale timespec is quite flexible as long as there are no ambiguities. Examples of various times and operand presentation include:
    at 0815am Jan 24
    at 8 :15amjan24
    at now "+ 1day"
    at 5 pm FRIday
    at '17




batch, crontab.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]