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

Spread the love

Open Mobile 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" < say_happy_new_year.sh

Here say_happy_new_year.sh 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: