Linux split Command
The Linux split command is used to divide a file into several smaller files.
This command splits large files into smaller ones, with each file containing 1000 lines by default.
Syntax
split [--help][--version][-<lines>][-b <bytes>][-C <bytes>][-l <lines>][file to be split][output file name]
Parameter Description:
-<lines>: Specifies how many lines per file.
-b<bytes>: Specifies how many bytes per file.
--help: Online help.
--version: Displays version information.
-C<bytes>: Similar to the "-b" parameter, but maintains line integrity when splitting.
[output file name]: Sets the prefix for the split files, which will be automatically numbered by split.
Example
To split the file "README" into files with 6 lines each using the "split" command, enter the following command:
$ split -6 README # Split the README file into files with six lines each
After executing the above command, the "split" command will split the original large file "README" into multiple small files prefixed with "x". Each of these small files will contain only 6 lines.
Use the "ls" command to view the current directory structure, as shown below:
$ ls # Execute ls command
# Get the current directory structure
README xaa xad xag xab xae xah xac xaf xai