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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. ghci: The Glasgow Haskell Compiler’s interactive environment
  2. ddcutil: command not found
  3. How to create LXC container using lxcbr0 and virbr0 in CentOS/RHEL
  4. parted: command not found
  5. gnome-screenshot Command Examples in Linux
  6. kpackagetool5: command not found
  7. lvmdiskscan Command Examples in Linux
  8. View files using – cat, more, tail, head and wc commands
  9. CentOS / RHEL : How to configure an DHCP server
  10. How to fix the error “host key verification failed”

You May Also Like

Primary Sidebar

Recent Posts

  • gixy Command Examples
  • gitsome Command Examples
  • gitmoji Command Examples
  • gitlint Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright