Don't ask why, but I would like to know a linux command, besides la -laR, since that could not take that long according to where you are in the folder structure, that takes much time to complete.

  • It actually depends on your requirements... do you need this command to be doing something non-trivial while it's running? For instance, are you looking for something that will access the hard drive for a certain amount of time? Or rearrange values in RAM, or transmit continuous network traffic for that time? Or do you just want something that will not return for a certain amount of time? (That's sleep) And what exactly do you mean by "much time"? Some specific amount of time, or indeterminate-but-longer-than-X-seconds, or what?
    – David Z
    Apr 16, 2010 at 4:58
  • 4
    @David: Didn't he tell you not to ask why? :P Apr 16, 2010 at 5:15
  • Yes, and I wasn't asking why he needs it, I was asking what exactly he needs. There's a difference.
    – David Z
    Apr 18, 2010 at 19:21
  • sleep was giving me strange results for some reason. Another option that I imagined up uses ping. e.g. ping -c10
    – rinogo
    Mar 27, 2019 at 19:30

6 Answers 6


sleep takes up however much time you pass to it.


dd if=/dev/zero of=/dev/null will run until your computer runs out of zeroes. :D

You can also make dd run for a finite amount of time, if you specify count or specify different values for if and/or of.

Or, if you want to do something useful, try badblocks -nvs /dev/sda, which will run a nondestructive read/write test on your first hard disk.

  • 4
    Careful, if you do run out of 0s write speed will slow down, as your HDD tries desperately to find an area with the right 0 configuration. It's easily fixable, though, just use another PC to connect and overwrite /dev/zero with their /dev/zero.
    – Phoshi
    Apr 16, 2010 at 11:08
  • @Phoshi: good point; I think that's what sysadmins refer to as "zero installation" or "zero maintenance."
    – rob
    Apr 19, 2010 at 19:00
  • I've found that /dev/zero compresses beautifully, though.
    – LawrenceC
    Nov 26, 2011 at 3:18

You could also simply repeat a command forever. For instance:

 $ while true ; do date ; done

updatedb this updates the locate database, so this is actually useful to run.


In Bash, the Korn shell and Z shell, you can use the SECONDS special variable if you want to delay for a certain time and avoid using an external tool such as sleep for some reason.

seconds=$SECONDS; while (( $SECONDS < seconds + 10 )); do :; done


SECONDS=0; while (( $SECONDS < 10 )); do :; done

The colon (:) is a no-op.


well find can run for a long time especially if you want to do specific task. Here is one command:

find / -size 15c

This will seach for files that have exactly 15 characters (in file that is) and it will scan whole HDD for it. This can be slow but if you use state of art computer then you can use other commands that can run endlessly. We can use find command in a loop:

while true; do find / -size 15c; done

The bad side of this command is that you are using HDD for this and if you run it often it may shorten your HDD life (im not very much HW educated so search on google for more details).

My personal choice for this task would be creating a series of random characters (95 in his case) and print them using infinte loop with this command:

while true; do echo head -c 95 /dev/urandom | tr -dc A-Z-0-9-a-z; done

If you have slow pc then use sleep command to delay the output for 1s (in this case) and save up some cpu power:

while true; do echo head -c 95 /dev/urandom | tr -dc A-Z-0-9-a-z && sleep 1; done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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