Split command on Linux (split files)
The split command in Linux (split) is used to split large files into smaller n-files. The output files are generated according to the number of lines in the input file. The default is to split the file every 1000 lines. The names of the output files follow the standard file aa files ab file ac, and so on. You can specify a suffix for the output file.
The most common option is:
- -n: Where n is the number of lines that will divide the input file;
- -b bytes: Divide the file into a defined number of bytes.
In this example, the grocery list file is divided into 4 files with the suffix “list” with two lines each:
-rw-rw-r— 1 ec2-user ec2-user ec2-user 53 Sep 13 08:40 supermarket