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.
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.