• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

at Command Examples in Linux

by admin

The at command is used to run a task once, at a specified time. It is not designed for repetitive or regularly scheduled tasks. The at command is very flexible. Users can specify a particular date and time, or cause the scheduled command to run after a given period of time. The command is typically used in an interactive manner, where the at command and time interval are specified, then a task is defined in an interactive prompt. This enables the user to enter a path to a script or a command to be run. Pressing Ctrl+D exits the interactive mode.

Syntax

The syntax of the at command is:

# at [options] {time}

at Command Options

Some of the at command options are described in the following table.

Options Used To
-m Send mail to the user when the job completes,
-M regardless of output.
-f {file name} Prevent mail from being sent to the user.
-t {time} Read a job from a file rather than standard input.
-v Run the job at the specified time value. Display the time the job will be executed.

Time Specifications

The at command takes several possible arguments for specifying time. Examples include:

  • noon to specify 12 P.M.
  • teatime to specify 4 P.M.
  • midnight to specify 12 A.M.
  • now + 3 minutes to specify the time three minutes from now.
  • now + 1 hour to specify the time one hour from now.

at Command Examples

1. Execute commands from standard input in 5 minutes (press `Ctrl + D` when done):

# at now + 5 minutes

2. Execute a command from standard input at 10:00 AM today:

# echo "./make_db_backup.sh" | at 1000

3. Execute commands from a given file next Tuesday:

# at -f path/to/file 9:30 PM Tue

Filed Under: Linux

Some more articles you might also be interested in …

  1. cut Command Examples in Linux
  2. RedHat / CentOS : Managing software RAID with mdadm
  3. How to Execute Scripts/Commands using /etc/rc.d/rc.local in CentOS/RHEL 7
  4. Unable To Extend LVM File System with Associated Snapshot in CentOS/RHEL
  5. LVM ISCSI Physical Volume Not Available After Server Reboot
  6. id Command Examples in Linux
  7. 10 useful cron examples to schedule jobs in Linux
  8. How to Create Disk Partitions using cfdisk
  9. How to use auditd to monitor a specific SYSCALL
  10. a2dissite: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright