Sometimes a file is too large to handle in one piece: an upload limit, a filesystem with a maximum file size, an email attachment cap, or a multi-gigabyte log you want to process in parts. The split command cuts files into chunks, and cat joins them back, byte for byte.
Split by size
split -b 500M backup.tar.zst backup.tar.zst.part-
ls backup.tar.zst.part-*
# backup.tar.zst.part-aa backup.tar.zst.part-ab …
Useful options:
split -b 1G -d -a 3 big.iso big.iso. # numeric suffixes: big.iso.000, big.iso.001 …
split -n 4 big.iso part- # exactly 4 equal parts
split -C 100M access.log access-part- # up to 100 MB, without breaking lines
Size units: K, M, G (powers of 1024), or KB, MB, GB (powers of 1000).
Split by lines (logs, CSVs)
split -l 100000 access.log access- # 100k lines per file
split -l 50000 -d --additional-suffix=.csv data.csv data-
For CSVs with a header row, add the header to each part:
tail -n +2 data.csv | split -l 50000 - part-
for f in part-*; do (head -n 1 data.csv; cat "$f") > "$f.csv" && rm "$f"; done
Join the parts
cat backup.tar.zst.part-* > backup.tar.zst
The shell sorts the glob alphabetically, which matches split’s suffix order (aa, ab, …, or 000, 001, …).
Verify the result
Always compare checksums before deleting the original:
sha256sum backup.tar.zst > backup.tar.zst.sha256 # before splitting
# … transfer the parts and the .sha256 file …
cat backup.tar.zst.part-* > backup.tar.zst
sha256sum -c backup.tar.zst.sha256
See Linux checksums.
Split while creating a backup (no huge intermediate file)
tar -cf - /srv/data | zstd -T0 | split -b 2G - /backups/data-$(date +%F).tar.zst.part-
# restore:
cat /backups/data-2026-10-01.tar.zst.part-* | zstd -d | tar -xf - -C /restore
See tar command examples and compression compared.
Split by content: csplit
csplit splits at lines matching a pattern, for example one file per section:
csplit -z -f section- config.txt '/^\[/' '{*}' # split before every line starting with [
csplit -z -f day- app.log '/^2026-10-0[0-9]/' '{*}'
Alternatives
- 7-Zip volumes:
7z a -v500m archive.7z dir/creates split archives that also compress and can encrypt. See 7-Zip on Linux. - rsync resumes interrupted transfers of large files, which often removes the need to split at all. See rsync examples.
- Object storage tools (rclone, aws s3) handle multipart uploads automatically.
Tips
- Keep the parts together, in one folder, and transfer the checksum file with them. A missing or truncated part makes the joined file useless.
- Name parts clearly, with the date and original name, so you know which set belongs together.
- For files you’ll transfer over unreliable connections, smaller parts (100–500 MB) mean less to resend when one fails.
- After joining and verifying, delete the parts, to free disk space.
- Splitting doesn’t compress or encrypt anything. Compress first (zstd or xz), and encrypt sensitive backups (restic, GPG or 7-Zip with a password) before sending them anywhere.
Quick reference
| Task | Command |
|---|---|
| Split by size | split -b 500M file prefix- |
| Numeric suffixes | -d -a 3 |
| Split by lines | split -l 100000 file prefix- |
| Keep lines whole | split -C 100M |
| Join | cat prefix-* > file |
| Verify | sha256sum -c file.sha256 |
Related: count files in a directory and VPS as a backup server.