Copying, Moving, and Splitting Files: Ten Measured Guides
Ten guides about moving data from one file to another: copying a tree or a single file, moving across filesystems, splitting a file into pieces, merging two files, and checking whether two files are the same.
Written November 11, 2026 · 4 min read
- What this page is
- Copying and moving files (6 guides)
- Splitting, merging, and comparing files (4 guides)
- Also on the site
What this page is
An index of the ten guides on the site about copying, moving, splitting, merging, and comparing files. Each line states what the guide measures, in the guide's own words, and links to the guide, which carries the full code, the probe output, and the measured numbers.
Copying and moving files (6 guides)
- Copying a Directory Tree, Measured: cp -a vs rsync -a vs tar-pipe; Copying a 10,000-file tree takes 0.16 seconds with a tar pipe and 0.38 with rsync -a — but on a single 1 GiB file cp -a wins at 0.45 seconds, rsync -a without a trailing slash nests the whole tree one level down, and tar keeps the seconds but not the nanoseconds.
- Copying a 1 GiB File: dd at bs=512 Is 9x Slower — and cp Ties dd Once the Block Size Is Right; dd at bs=512 takes 3.6 seconds to copy a 1 GiB file; at bs=1M it takes 0.4 — and plain cp ties it. The block size is the decision, not the tool.
- mv Across Filesystems, Measured: One Rename or a Full Copy; Moving a 1 GiB file with mv takes 0.002 seconds on one filesystem and about 1 second across filesystems. A 10,000-file tree is the same story: one rename on the same filesystem, a full copy across. mv preserves the timestamp across filesystems; plain cp does not.
- Copying a Sparse File, Measured: Which Tools Preserve the Holes; Copying a 1 GiB sparse file takes 0.0042 seconds with plain cp and 1.7 seconds with plain rsync — and cp keeps the file at 3 MiB on disk while rsync expands it to the full 1 GiB. dd conv=sparse and rsync --sparse preserve the holes at a cost; cat and plain dd fill them.
- Copying a File Without read() and write() Is About Twice as Fast: sendfile vs copy_file_range vs splice, Measured; At 1 GiB, sendfile, copy_file_range, and splice copy a file in 365–467 ms against 854 ms for a read/write loop on median — about twice as fast. At 64 MiB the edge is gone, and at 1 MiB it is noise. Measured on Linux, 3 reps per cell, two nights.
- rsync's 2,729x Speedup Is 1% Slower on the Clock: Delta vs Whole-File, Measured in Wall-Clock; rsync reported 'speedup is 2,729.37' for a delta transfer that moved 32,768 literal bytes — and the clock said it took 35.00 seconds against 34.63 for the whole-file copy. The same probe last night said 43 percent slower. The byte counter is not a clock, and the gap does not reproduce.
Splitting, merging, and comparing files (4 guides)
- Cutting a Million-Line File Into Ten, Measured: split vs csplit vs awk; Splitting a million-line file into ten chunks takes 0.031 seconds with split and 0.31 with awk — and split -n r/10 scrambles the order, split -b makes an eleventh chunk, and csplit leaves an empty first file when the pattern matches line 1.
- paste vs join, Measured: Fast by Position, Wrong by Key; On a million lines, paste merges two files in 0.087 seconds and join takes 0.155 — but paste pairs rows by position, not by key. On shuffled files every one of the million pairings is wrong, and on a file with 1,000 missing keys 997,204 rows carry the wrong value. join drops unmatched keys and fails loudly on unsorted input.
- Joining Two Files on a Key: join vs awk, Measured; Merging a million fact rows against a 100,000-key lookup costs 0.07 seconds with join on pre-sorted inputs and 0.46 with an awk hash merge on GNU coreutils 9.4 and gawk 5.2.1 — and even paying for both sorts, join still wins 1.73 times over awk.
- Are These Two Files the Same? cmp vs diff, Measured — Plain diff Costs 100x on Text and Nothing Extra on Binary; On a 1 GiB binary file cmp, diff -q and plain diff cost the same. On a million-line text file, plain diff costs 100x more than diff -q when the difference is on line 1. The equality check is -q, not diff itself.
Also on the site
- Measured Comparisons: 30 Head-to-Head Guides, November 9–10, 2026 — the full measured series, including all ten guides above.
- Concurrency, Async, and Waiting: Fifteen Guides on Threads, Coroutines, and Waking Up — a topical cross-hub on a different theme.
Related guides on this site
- Cutting a Million-Line File Into Ten, Measured: split vs csplit vs awk
- Copying a Sparse File, Measured: Which Tools Preserve the Holes
- Editing a File In Place, Measured: sed -i vs perl -pi vs awk
- Copying a File Without read() and write() Is About Twice as Fast: sendfile vs copy_file_range vs splice, Measured
Keep Exploring
Paste a [Service] section and get a plain-language verdict on every sandboxing setting it finds.
Paste sshd -G output and get a hardening verdict on the values your server actually runs.
Paste a server block and get WebSocket, TLS, HSTS, and proxy-header verdicts.
Paste a systemd timer expression and get the specific reason it fails, the normalized form, and the past-date traps the built-in check hides.
The full sysadmin hub \u2014 systemd, cgroups, file tools, and measured Linux comparisons.