Text and processing

The split command

Splits a large file into smaller chunks. Very useful to upload or move files in parts.

Syntax

split [-l N | -n N] [-d] archivo [prefijo]

Most useful options

-l NN lines per chunk
-n NSplit into N equal chunks
-dNumeric suffixes (00, 01...) instead of letters

Copy-ready examples

$ printf '1\n2\n3\n4\n' > big.txt && split -l 2 big.txt parte && cat parteaaSplit every 2 lines

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • split does not join the chunks back: for that use cat part* > file.

Related commands

FAQ

How do I join the parts back?

With cat partaa partab > original.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course