Super User is a question and answer site for computer enthusiasts and power users. 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

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.

share|improve this question
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 '10 at 4:58
@David: Didn't he tell you not to ask why? :P – Ignacio Vazquez-Abrams Apr 16 '10 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 '10 at 19:21
up vote 17 down vote accepted

sleep takes up however much time you pass to it.

share|improve this answer

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.

share|improve this answer
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 '10 at 11:08
@Phoshi: good point; I think that's what sysadmins refer to as "zero installation" or "zero maintenance." – rob Apr 19 '10 at 19:00
I've found that /dev/zero compresses beautifully, though. – LawrenceC Nov 26 '11 at 3:18

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

 $ while true ; do date ; done
share|improve this answer

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

share|improve this answer

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.

share|improve this answer
That's a hard way of doing 'sleep 10'? – Jonathan Leffler Apr 18 '10 at 0:37
Yes, as I thought I indicated. – Dennis Williamson Apr 18 '10 at 1:19

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

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .