atq Command in Linux



atq is a command-line utility in the Linux system that allows users to schedule one-time tasks or jobs to run at a specific time. The atq command is a part of at family of commands that also includes commands like at, atrm and batch.

With the at command, the users can create and submit jobs by specifying the time for their execution. These jobs created through the at command are stored in the queue and await for their time to execute on the system terminal. You can display these pending jobs information on the terminal using the atq command. The information displayed through the atq command includes job number, time to execute the job, queue and username.

Table of Contents

Syntax for atq Command in Linux

The basic syntax for the atq command in Linux is provided below −

atq [-V] [-q queue]

Here, V displays the version number to the standard error and after that, exists successfully. While, q shows jobs from the specified queue. In atq, the queues are denoted with single letters from a to z, or A to Z.

By default, a is the queue for at, while b is the queue for batch. If a job is assigned to a queue marked with an uppercase letter, it is treated as though it were submitted to the regular batch queue at the time of the job.

Examples of atq Command in Linux

With the atq command on Linux, you can −

  • Checking Version at Command Version
  • Listing All Pending Jobs
  • Showing Job for a Specific Queue Name

Let’s discuss these examples.

Check at Command Version

You can check the version of the at command installed on your Linux system with the atq command followed by the -V argument, as given below −

atq -V
atq Command Linux 1

List All Pending Jobs

If you want to list all pending jobs for the current user on your Linux system, you can use the atq command without an argument −

atq
atq Command Linux 2

Show Job for a Specific Queue Name

If you want to view a job for a specific queue, you can use the atq command followed by the -q argument for the queue and queue name in the last. Let’s find the job information of a queue named a using the following command −

atq -q a
atq Command Linux 3

Note − You can also use an alternate at command with -l option to list all pending jobs on the terminal, similar to the atq command.

at -l
atq Command Linux 4

Conclusion

atq command is a powerful Linux command that is used to get the list of pending at command’s jobs or tasks. The atq command is used to check the version of at command with -V option, list pending jobs without an option, and view the jobs for a specific queue using -q option.

We explained all these commands in detail in this article. Follow them as they will help you at times when you schedule jobs on your Linux system with the at command.

Advertisements