Name

at — stdin  stdout  - file  -- opt  --help  --version

Synopsis

at [options] time_specification

The at command runs a list of shell commands once at a specified time. It reads its shell commands from standard input, so press ^D when you’re finished typing them:

at 7am
echo Remember to go shopping | mail smith
lpr $HOME/shopping-list
^D
job 559 at 2012-07-14 21:30

Of course, you can send commands to at using a pipeline:

echo lpr myfile | at 7am

The commands run in the background, not in your current shell, so they are not interactive. You cannot see anything they print (say, using echo) unless you redirect the output to a file or pipe it to another program that can communicate with you (such as mail in our example). Likewise, you cannot provide input to these commands from the keyboard.

The time specifications understood by at are enormously flexible. In general, you can specify:

  • A time followed by a date (not a date followed by a time)

  • Only a date (assumes the current clock time)

  • Only a time (assumes the very next occurrence, whether today or tomorrow)

  • A special word like now, midnight, or teatime (16:00)

  • Any of the preceding followed by an offset, like “+ 3 days”

Dates are acceptable in many forms: december 25 2012, december 25, 12/25/2012, 25.12.2012, today, thursday, and more. Month names can be abbreviated to three letters (jan, feb, mar, ...). Times are also flexible: 8pm, 8 pm, 8:00pm, 8:00 pm, 20:00, and 2000 are equivalent. Offsets are a plus or minus sign followed by whitespace ...

Get Macintosh Terminal Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.