A few words of thanks would be greatly appreciated.

Split a File Into Several Parts in Linux

There is sometimes a need to split a large file into smaller ones for ease of operation and optimum memory utilisation. When you split, you can read it using a normal text editor. This article will you show you how.

How to Spilt a File in Linux

To split large file into smaller ones in Linux, use split command. Just follow the steps below and you will be able to split large file into smaller files. Not all Operating Systems have such pre-assigned commands that you need to explore.

Type in the shell $ split -bytes=1m /path/to/large/file/path/to/output/file/prefix.Now the big file is split into smaller ones.Control the output file size by modifying the -bytes=1m to your wish. Use b, k, or m.b which represents bytes, k represent kilobytes, m represent megabytes. Now for restoring large original file,use the cat command and later just use the join command to get the file back type $ cat prefix* as NEW FILENAME.

Necessary Steps

Linux is full of utility tools allowing you to manipulate files. There is a very handy tool to split a file into several parts (for example to carry data on low capacity media).

  • The split command:
    split -b 1440k my_big_file

The split command will create files - named xaa, xab, xac etc. - of 1440KB or less.

  • To recover the whole file simply use the cat command as follows:
    cat xaa xab Xac>> my_big_file 

The join command may also be convenient for this purpose.
Photo: Unsplash


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Split a File Into Several Parts in Linux », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).