Skip to content

Instantly share code, notes, and snippets.

@JakSprats
Created June 18, 2011 07:39
Show Gist options
  • Save JakSprats/1032900 to your computer and use it in GitHub Desktop.
Save JakSprats/1032900 to your computer and use it in GitHub Desktop.
Bash script to thrash disk
#!/bin/bash
T=$(tempfile)
time sudo find /usr -type f| sort -R | head -n 4000 | sed -e "s/\ /\\\ /g" > $T
rm -f rand.files
I=0
FILES=""
cat $T | while read file; do
if [ $I -lt 25 ]; then
FILES="$FILES $file"
I=$[${I}+1]
else
echo "$FILES"
I=0
FILES=""
fi
done >> rand.files
cat rand.files | sort -r | while read file; do
taskset -c 0 md5sum ${file} & </dev/null;
done
echo LAUNCHED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment