split
file processingLinux/Unix
The split command is one of the most frequently used commands in Linux/Unix-like operating systems. split Split a file into pieces
Quick Reference
Command Name:
split
Category:
file processing
Platform:
Linux/Unix
Basic Usage:
split [options] [arguments]
Common Use Cases
Syntax
split [options] [input [prefix]]
Options
Option | Description |
---|---|
-a, --suffix-length=N |
Generate suffixes of length N (default 2) |
-b, --bytes=SIZE |
Put SIZE bytes per output file |
-C, --line-bytes=SIZE |
Put at most SIZE bytes of lines per output file |
-d, --numeric-suffixes[=FROM] |
Use numeric suffixes instead of alphabetic, start at FROM |
--hex-suffixes[=FROM] |
Use hexadecimal suffixes instead of alphabetic, start at FROM |
-l, --lines=NUMBER |
Put NUMBER lines per output file |
-n, --number=CHUNKS |
Generate CHUNKS output files (Only with -l or -b) |
--filter=COMMAND |
Write to shell COMMAND; file name is $FILE |
-u, --unbuffered |
Immediately copy input to output with '-n r/...' |
--additional-suffix=SUFFIX |
Append an additional SUFFIX to file names |
--help |
Display help and exit |
--version |
Output version information and exit |
SIZE Units | Description |
---|---|
K |
1 Kilobyte (1024 bytes) |
M |
1 Megabyte (1024 KB) |
G |
1 Gigabyte (1024 MB) |
T |
1 Terabyte (1024 GB) |
P |
1 Petabyte (1024 TB) |
Examples
How to Use These Examples
The examples below show common ways to use the split
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
split large_file.txt