Ask a question »

Linux - Cutting a file into several parts

April 2015

There is sometimes a need to split a large file into smaller ones for ease of operation and optimum memory utilization.When you split,you can read it using a normal text editor.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.

[Linux]Cutting a file into several parts




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.
For unlimited offline reading, you can download this article for free in PDF format:
Linux-cutting-a-file-into-several-parts.pdf

See also

In the same category

Published by jak58. - Latest update by Paul Berentzen
This document entitled « Linux - Cutting a file into several parts » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.