How to Break Large Files into Chunks Using the split Command in Linux

When you attempt to transfer a massive, 15-Gigabyte log file or a gigantic database dump across an unstable network connection, the file will almost certainly fail halfway through. Many email servers and cloud storage providers enforce strict 2-Gigabyte file size limits, mathematically preventing you from uploading the master file. To instantly break a massive file into perfectly sized, manageable chunks without destroying the underlying data architecture, you must use the split command.

Splitting Files by Line Count

If you are working with a massive text file—such as a list of 10 million email addresses—splitting the file by raw byte size is highly dangerous because it might physically slice an email address in half (e.g., separating “john@” from “gmail.com”). You must instruct the engine to split the file by the number of line breaks.

To split a massive file named master_database.csv into smaller files containing exactly 50,000 lines each, use the -l (lines) flag:

split -l 50000 master_database.csv chunk_

The split engine will instantly rip through the master file. Every time it hits exactly 50,000 lines, it stops, creates a brand new file, and resumes. It automatically names the output files using the prefix you provided (chunk_), appending alphabetical suffixes to maintain perfect mathematical order:

  • chunk_aa
  • chunk_ab
  • chunk_ac

Splitting Files by Byte Size

If you are dealing with a massive binary file—like a compressed .tar.gz archive or a giant video file—line counts are completely irrelevant. You must split the file by pure mathematical byte size.

To forcefully slice a 10-Gigabyte backup archive into exactly 2-Gigabyte chunks so it can bypass cloud storage limitations, use the -b (bytes) flag followed by the human-readable size (e.g., 2G for Gigabytes, 500M for Megabytes):

split -b 2G server_backup.tar.gz backup_part_

The system will output a sequence of perfectly sized 2GB files (backup_part_aa, backup_part_ab, etc.).

Reassembling the Chunks

Once you successfully transfer the smaller chunks across the network to the target server, you must mathematically stitch them back together to reconstruct the original master file.

Because the split command automatically applied alphabetical suffixes (aa, ab, ac), the files are perfectly sorted. You simply use the standard cat (concatenate) command with a wildcard (*) to smash them back together:

cat backup_part_* > restored_server_backup.tar.gz

The Linux kernel will instantly merge the chunks in exact alphabetical order, generating a perfect, mathematically identical clone of your original 10-Gigabyte file.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.