Linux Commands

Split Command in Linux

“The split command in Linux is used for splitting the files into multiple chunks. This command comes in handy in situations where you have extremely large files, and you want them to be easily manageable. In this guide, we will be sharing with you the simplest method of using the split command in Linux.”

Simplest Usage of the Split Command in Linux

To use the split command in the simplest way on a Linux system, you have to follow the steps described below:

Step # 1: Visualize the File to be Split

First of all, we will take a look at the file that we wish to split. For that, we will execute the following command:

$ cat file.txt

The name of the file that we wish to split in this case is “file.txt”. You can pass any file of your choice to this command.

The contents of this file are shown in the image below:

Step # 2: Split the File Into the Desired Number of Chunks

Now, since you can witness from the step explained above that the file that we wish to split is not that long; therefore, we will split it into multiple chunks according to a customized number of lines for each of these chunks. The command that we have used for this purpose is as follows:

$ split –l 1 file.txt

The “-l” flag of the split command in Linux allows you to define a number according to which the chunks will be created. Since we have set this number to be “1” and since the total number of lines in our original file was “5”, therefore, this file will be divided into “5” different chunks containing “1” line each, i.e., xaa, xab, xac, xad, and xae respectively. However, no output will be produced on the terminal upon the execution of this command.

Therefore, to confirm if the desired chunks have been created or not, you can run the “ls –l” command. The highlighted portion in the output of this command shows that the said chunks have successfully been created.

Step # 3: Verify the Contents of the Newly Created Chunks

If you want to verify the contents of the newly created chunks, then you can run the following command:

$ cat xaa

The content of this particular chunk is shown in the image below. In the same manner, you can check the contents of all the other chunks as well and hence, verify that these chunks actually contain the different lines of the original file.


To know more about the usage and the different options of the split command, you can simply run the command that follows:

$ split --help

This command will take you straight to the help manual of the split command, from where you can learn more about this command, as shown in the image below:


This article was dedicated to the basic usage of the split command in Linux. By default, this command splits a file into different chunks where each chunk spans 1000 lines. This is exactly why it is most suitable for large files. However, you can still use it for splitting the small files into multiple chunks by following the procedure that we have shared with you in this guide.

Similar Posts