Skip to content

Instantly share code, notes, and snippets.

@yaasita
Last active May 26, 2021 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaasita/df7f1aad5fbb49e6dd9914d4bebda96b to your computer and use it in GitHub Desktop.
Save yaasita/df7f1aad5fbb49e6dd9914d4bebda96b to your computer and use it in GitHub Desktop.
# show version
fdupes --version
fdupes 2.1.2
# Same size 10G file
ls -l
合計 20971536
-rw-r--r-- 1 root root 10737422336 2021/05/06_02:44:42 1.dat
-rw-r--r-- 1 root root 10737422336 2021/05/06_02:47:10 2.dat
# Same for up to 4096 bytes
cmp *.dat
1.dat 2.dat differ: char 4097, line 1
# clear disk chache
echo 3 > /proc/sys/vm/drop_caches
# exec
time fdupes .
real 2m12.252s
user 0m44.251s
sys 0m12.606s
# Create a diff at byte 4096
echo -n "a" | dd of=1.dat bs=1 seek=4095 conv=notrunc
echo -n "b" | dd of=2.dat bs=1 seek=4095 conv=notrunc
cmp *.dat
1.dat 2.dat differ: char 4096, line 1
# clear disk chache
echo 3 > /proc/sys/vm/drop_caches
# exec
time fdupes .
real 0m0.224s
user 0m0.004s
sys 0m0.007s
# Fast because there is a difference within 4096 bytes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment