To schedule a command or script to run at some particular time, the at command is perfect and provides many options for specifying the time you want it to run. It will set the task up to be run whenever you specify, and you can view the scheduled tasks or even change your mind and cancel one of them as you see fit. The at command differs from cron in that it sets up a command or script to run only once, while cron allows you to set up commands or scripts to be run on a specified schedule – whether every day, once a week, a couple times a month or even just once a year. at command syntax Using the at command is relatively easy, though it has a lot of options, particularly on how you specify the time a task should be run. If you specify a time like shown below, the task will be set up to be run the next time you reach 15:27 (3:27 PM), whether that’s today or tomorrow. $ at 15:27 warning: commands will be executed using /bin/sh at Wed Mar 15 15:27:00 2023 at> echo "It works!" > /tmp/test at> job 5 at Wed Mar 15 15:27:00 2023 End the at command by pressing ^D. In the next example, the command is set to run the following date at the time specified. $ at 12:34 tomorrow warning: commands will be executed using /bin/sh at Wed Mar 15 12:34:00 2023 at> echo 1234 >> /tmp/wow at> job 6 at Wed Mar 15 12:34:00 2023 You can specify the time of day in either of two formats. If you ask to have a command run at 11:11, it will be run at 11:11 AM. To specify it to run at 11:11 PM, use 23:11 or 11:11pm as the time. Dates can be also specified in any of these formats: MMDD[CC]YY MM/DD/[CC]YY DD.MM.[CC]YY [CC]YY-MM-DD You can also specify a task on some particular date by specifying a weekday (e.g., Sunday). $ at noon Wednesday warning: commands will be executed using /bin/sh at Wed Mar 15 12:00:00 2023 at> date >> /tmp/test at> job 7 at Wed Mar 15 12:00:00 2023 Listing at jobs To list the tasks scheduled with the at command, use the atq (at queue) command. $ atq 5 Wed Mar 15 15:27:00 2023 a shs 6 Wed Mar 15 12:34:00 2023 a shs 7 Wed Mar 15 12:00:00 2023 a shs The command shows the jobs waiting to be run, but not the tasks they will be running. The details only include the job numbers, the times they will run and the user who added them. Only root is able to view all of the scheduled tasks. Other users will see only their own. Deleting at jobs You can cancel a scheduled job with the atrm command. $ atrm 5 $ atq 6 Wed Mar 15 12:34:00 2023 a shs 7 Wed Mar 15 12:00:00 2023 a shs The command below provides a list of commands associated with the at command. $ sudo dnf repoquery -l at | grep bin [sudo] password for shs: Last metadata expiration check: 1:16:38 ago on Fri 10 Mar 2023 01:40:19 PM EST. /usr/bin/at /usr/bin/atq /usr/bin/atrm /usr/bin/batch /usr/sbin/atd /usr/sbin/atrun /usr/bin/a Wrap-up Regularly scheduled tasks should be set up using the cron command, but to run some particular task at some particular time (no repeats), the at command is flexible and easy.. Related content how-to How to examine files on Linux Linux provides very useful options for viewing file attributes, such as owners and permissions, as well as file content. By Sandra Henry Stocker Oct 24, 2024 6 mins Linux how-to 8 easy ways to reuse commands on Linux Typing the same command again and again can become tiresome. Here are a number of ways you can make repeating commands – or repeating commands but with some changes – a lot easier than you might expect. By Sandra Henry-Stocker Oct 15, 2024 5 mins Linux news SUSE Edge upgrade targets Kubernetes and Linux at the edge SUSE Edge 3.1 includes a new stack validation framework and an image builder tool that are aimed at improving the scalability and manageability of complex Kubernetes and Linux edge-computing deployments. By Sean Michael Kerner Oct 15, 2024 6 mins Edge Computing Linux Network Management Software how-to Lesser-known xargs command is a versatile time saver Boost your Linux command line options and simplify your work with xargs, a handy tool for a number of data manipulation tasks. By Sandra Henry Stocker Oct 11, 2024 6 mins Linux PODCASTS VIDEOS RESOURCES EVENTS NEWSLETTERS Newsletter Promo Module Test Description for newsletter promo module. Please enter a valid email address Subscribe