11 Practical usages of “split” command

“split” command is used to split a large file into manageable small pieces.

Syntax: split [OPTION]… [FILE [PREFIX]]

Here are the command options:

Split a file into pieces


When you split a file with no options, the file chunks created start with x followed by two alphabets in the following manner.

Customize the suffix length (-a option)


You can customize the length of the suffix of the generated chunks using –a option.

Split a file by number of lines (-l option)


You can create the chunks with desired number of lines. The example below creates files with 500 lines in each.

Split a file by file size (-b option)


You can split a file based on the desired size of the chunk.

  • -b nK    splits into nKB files
  • -b nM    splits into nMB files
  • -b nG    splits into nGB files

In the example below, we split a 559k file into 100k files.

 $ split -b 100k addressbook.db 

Split a file with numeric suffix (-d option)


You can have the suffix with numbers using the -d option.

$ split -d addressbook.db

Split a file with custom suffix


You can have the suffix with numbers using the -d option.

In the example below, we will add myfiles- as the suffix.

 $ split addressbook.db  myfiles-

Split a file into n number of files (-n option)


You can split a file into fixed number of chunks using the -n option.

The example below split the file into three files

  $ split -n3 addressbook.db

Do not generate empty output files (-e option)


With certain scenarios, the split command ends up creating empty files. Using the -e option, you can force the split command not to create empty files.

  $ split -e addressbook.db

Print additional information (–verbose option)


use –verbose potion

Display help


  $ split --help

Display version information

  $ split --version