Master Linux File Splitting and Merging with split and cat
This guide explains why large files often need to be split on Linux for easier transmission, demonstrates how to use the split command with various options and examples, and shows how to recombine the pieces efficiently using the cat command.
Because of network transmission limits, large files often need to be split on Linux, transferred in pieces, and then merged.
File Splitting – split
The split command makes splitting large files easy.
Syntax
-a # set suffix length (default 2: aa, ab...)
-d # use numeric suffixes
-l # split by number of lines (default 1000)
-b # split by bytes (supports units: k/m)
-C # split by size while preserving line integrity
split [-a] [-d] [-l <lines>] [-b <bytes>] [-C <bytes>] <input_file> <output_prefix>Examples
# Split by lines
$ split -l 300000 users.sql /data/users_
# Use numeric suffixes
$ split -d -l 300000 users.sql /data/users_
# Split by byte size
$ split -d -b 100m users.sqlFor help, run split --help which displays options such as -a, -d, -l, -b, -C, and others.
File Merging – cat
The cat command can concatenate the split pieces back into a single file.
Syntax
-n # show line numbers
-e # display $ at end of each line
-t # show TAB characters (^I)
cat [-n] [-e] [-t] <output_file>Examples
# Merge files
$ cat /data/users_* > users.sqlHelp: cat --help shows options like -A, -b, -e, -E, -n, -s, -t, -T, etc.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
