LinuxCommandLibrary

atq

List pending 'at' jobs

TLDR

Show the current user's scheduled jobs

$ atq
copy

Show jobs from the a [q]ueue (queues have single-character names)
$ atq -q [a]
copy

Show jobs of all users (run as superuser)
$ sudo atq
copy

SYNOPSIS

atq [-V] [-q queue] [-v] [job ...]

PARAMETERS

-V
    Print version information and exit.

-q queue
    Display only jobs in the specified queue (e.g., 'a', 'b').

-v
    Verbose mode: show additional job details and completed jobs.

job ...
    Display only the specified job numbers (e.g., '5', '42.a').

DESCRIPTION

The atq command queries and displays jobs scheduled for future execution via the at or batch commands in Unix-like systems. Managed by the atd daemon, these are one-time tasks.

By default, it lists the current user's pending jobs in a compact format: job_number queue month_name day time year user. For example: 5 a Mon Oct 5 12:00:00 2023 user. Jobs are sorted by queue then time. Root sees all users' jobs; others see only their own.

Specify job numbers to view particular entries. The -q option filters by queue (e.g., 'a' for at, 'b' for batch). Verbose -v mode shows more details, including the job's command and completed jobs not yet removed.

Essential for monitoring non-recurring tasks where cron falls short. Jobs reside in /var/spool/cron/at* or equivalent, with numbers unique per queue (e.g., '42.a'). No jobs yields 'no files'.

Integrates with atrm for deletion and at -c for viewing contents.

CAVEATS

Requires running atd daemon; job numbers unique per queue only. Non-root users see own jobs exclusively. Output may vary slightly by implementation.

HISTORY

Originated in BSD Unix (1980s), ported to SysV and Linux. GNU version in 'at' package since 1990s, widely used for at/batch scheduling.

SEE ALSO

at(1), atrm(1), atd(8), batch(1)

Copied to clipboard