Software & Apps Linux Learn the Linux Command - at Use the 'at' command and its related commands to schedule tasks By Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated December 08, 2019 Caspar Benson / Getty Images Linux Switching from Windows Tweet Share Email The at, batch, atq, and atrm Linux commands queue, examine or delete jobs for later execution. These commands may not be installed by default. The typical method of scheduling tasks is through cron, not at and its related commands. How To Edit The Linux Crontab File To Schedule Jobs Synopsis These commands take the following general forms: at [-V] [-q queue] [-f file] [-mldbv] TIMEat -c job [job...]atq [-V] [-q queue]atrm [-V] job [job...]batch [-V] [-q queue] [-f file] [-mv] [TIME] Description The at and batch commands read intended commands from standard input or a specified file which are to be executed at a later time, using the shell set by the user's environment variable SHELL, the user's login shell, or ultimately /bin/sh. These four commands interrelate: at: Executes commands at a specified time.atq: Lists the user's pending jobs, unless the user is the superuser; in that case, everybody's jobs are listed. The format of the output lines (one for each job) is: Job number, date, hour, job class.atrm: Deletes jobs, identified by their job number.batch: Executes commands when system load levels permit; in other words, when the load average drops below 0.8, or the value specified in the invocation of atrun. Usage Notes At allows fairly complex time specifications. It accepts times of the form HH:MM to run a job at a specific time of day. If that time is already past, the next day is assumed. You may also specify midnight, noon, or teatime (4 p.m.) and you can have a time-of-day suffixed with AM or PM for running in the morning or the evening. You can also say what day the job will be run, by giving a date in the form month-name day with an optional year, or giving a date of the form MMDDYY or MM/DD/YY or DD.MM.YY. The specification of a date must follow the specification of the time of day. You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow. For example, to run a job at 4 p.m. three days from now, you would do at 4 p.m. + 3 days, to run a job at 10 a.m. on July 31, you would do at 10 a.m. Jul 31 and to run a job at 1 a.m. tomorrow, you would do at 1 a.m. tomorrow. For both at and batch, commands are read from standard input or the file specified with the -f option and executed. The working directory, the environment and the umask are retained from the time of invocation. An at - or batch - command invoked from a su shell will retain the current user id. The user will be mailed standard error and standard output from his commands, if any. Mail will be sent using the command /usr/sbin/sendmail. If at is executed from a su shell, the owner of the login shell will receive the mail. Superusers and Privileges The superuser may use these commands in any case. For other users, permission to use at is determined by the files /etc/at.allow and /etc/at.deny. If the file /etc/at.allow exists, only usernames mentioned in it are allowed to use at. If /etc/at.allow does not exist, /etc/at.deny is checked, every username not mentioned in it is then allowed to use at. If neither exists, only the superuser is allowed use of at. An empty /etc/at.deny means that every user is allowed use these commands—this situation is the default configuration. When you run at in an interactive session, press Ctrl+D to end the at session. Options The commands take the following optional switches, as specified above: -V: Prints the version number to standard error.-q queue: Uses the specified queue. A queue designation consists of a single letter; valid queue designations range from a to z. and A to Z. The a queue is the default for at and the b queue for batch. Queues with higher letters run with increased niceness. The special queue "=" is reserved for jobs that are currently running. If a job is submitted to a queue designated with an uppercase letter, it is treated as if it had been submitted to batch at that time. If atq is given a specific queue, it will only show jobs pending in that queue.-m: Send mail to the user when the job has completed even if there was no output.-f file: Reads the job from file rather than standard input.-l: Alias for atq.-d: Alias for atrm.-v: Shows the time the job will be executed.-c: Cats the jobs listed on the command line to standard output.