Site icon

Quick Tip: Run a command at a specified time in linux – Answer isn’t Cron

You are currently viewing the Mobile Optimized version (AMP), some features may be missing or may not work as expected. Open Full Version.

When you want to run a command at a particular time in Linux look no further than the at command.

It might come bundled with your flavour of Linux but if not then you should be able to quickly install it using your package manager.

On debian based systems run:

 sudo apt install at  

Then running your command is as simple as:

at "11:59PM 31 dec 2020" <

Here contains the bunch of commands that you want to run.

If you just want to run a single command do something like:

echo 'ls -lah' | at "6:40am 28 dec 2020"

at accepts the most common time formats out of the box, which makes it pretty easy to use.

I had overlooked this little utility for so long but I’m pretty sure this is going to help a lot going forward.