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.
6 Answers
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.
-
4Careful, 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.– PhoshiApr 16, 2010 at 11:08
-
@Phoshi: good point; I think that's what sysadmins refer to as "zero installation" or "zero maintenance."– robApr 19, 2010 at 19:00
-
You could also simply repeat a command forever. For instance:
$ while true ; do date ; done
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
or
SECONDS=0; while (( $SECONDS < 10 )); do :; done
The colon (:
) is a no-op.
-
2
-
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
sleep
) And what exactly do you mean by "much time"? Some specific amount of time, or indeterminate-but-longer-than-X-seconds, or what?sleep
was giving me strange results for some reason. Another option that I imagined up usesping
. e.g.ping -c10 8.8.8.8