Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use this

sleep 900; <command>

on my shell. Just wanted to know is there is some alternate/better way that you use?

share|improve this question
you can do sleep 15m && command, that way if you want to cancel it you can ctrl-c it (your version would run the command if you ctrl-c it). – OneOfOne Apr 25 '11 at 0:54
@OneOfOne I don't know if it's shell or something else dependent, but I've never seen Ctrl+C fallthrough like that; it cancels the entire line – Michael Mrozek Apr 25 '11 at 8:28
@Michael I coulda swore it used to do that with older bash, I just tried and it didn't, so ignore my comment – OneOfOne Apr 25 '11 at 18:37
@OneOfOne: It did up to bash 3.x; that's fixed in bash 4. – Gilles Apr 25 '11 at 21:58
Thanks @Gilles, I thought I was being crazy :D – OneOfOne Apr 26 '11 at 4:21
up vote 22 down vote accepted

You are searching for at (at@wikipedia)?

usr@srv % at now + 15 min

You can define multiple commands that should be executed in 15 min, seperate them with a return.
Confirm all commands with control+d.

share|improve this answer

I use a short script I keep in my path, called after, containing

at now + "$@"

This way it's very easy to, for example, type:

after 15 min

then any commands and Ctrl-D, or

echo COMMANDS | after 15 min

which does the same.

share|improve this answer
you might want to use "$@" instead of $* -- then arguments containing spaces will be properly quoted – glenn jackman Apr 25 '11 at 11:12
Thanks for the tip. I edited my answer accordingly. I think it doesn't change anything in the context of the at command, bu it's definitely better standard practice. – Dalker Apr 28 '11 at 8:15
you need to use the quotes around it: specifically "$@" not $@. Only when quoted will bash perform this special expansion: gnu.org/software/bash/manual/bashref.html#Special-Parameters – glenn jackman Apr 28 '11 at 10:26
@glenn, re-edited accordingly. Thanks for the tip, I didn't know that! – Dalker Apr 28 '11 at 22:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.