How to split large file into several smaller files - Linux

Have you ever want to split a large file into several small files? I’ve face this problem few days ago. I need to split a large file (3GB log file) into several smaller file where i can read it using normal text editor.
To split large file into several smaller files, you can use split command in linux. Just follow the steps below and you will be able to split large file into smaller files.
-
in your shell key in
$ split –bytes=1m /path/to/large/file
/path/to/output/file/prefix - Done. You just split your large file into several smaller files
* You can change the output file size by changing the –bytes=1m to your preference. You can use b, k, or m. b represent bytes, k represent kilobytes, m represent megabytes.
To restore the original file, you can use cat command.
To join all the smaller file to restore the original file type:-
$ cat prefix* > NEWFILENAME
If you need to convert larger files into smaller ones, consider getting PDF software. If you are looking for the best in pdf conversion, sign online today. We have the perfect software to convert pdf to word and so much more! Sign online for all of your computer software needs!
Posted at March 1st, 2007 by chuaIf you think this article helps you to solve your problem and clear your headache, feel free to buy me a drink :)








April 26th, 2007 at 3:55 am
thanks for this post! i found it ’cause i needed it.
one thing, there should be two dashes before ‘bytes’.
split –bytes=2m /large/file /smaller/files/prefix
May 4th, 2007 at 2:32 pm
Just in case anybody needed (I did): if you use this command to split a binary file on *NIX and then copy the output to a DOS-aware system (Windows, for that matter) you can concatenate all the chunks using:
$> copy /B chunk* output
September 9th, 2007 at 11:46 pm
Very nice, but I need to recover the original file in a windows XP system. Command copy not found in execute prompt. What can I do then? Thx.
September 28th, 2007 at 11:32 pm
If winxp does not have the copy command you can download the linux cat command for windows. Go to http://unxutils.sourceforge.net/ and download the unix utils, they’re free.
Then you can restore the files just as with the linux example above.
March 25th, 2008 at 4:44 pm
[...] check this link. [...]
August 26th, 2008 at 3:48 am
I’m using cygwin on WXP to try to put my split files back together, but I cannot cat a file larger than 4GB. Is there another way?
August 27th, 2008 at 4:28 am
actualy in windows you can do:
$> type filepart1 filepart2 > filefull
August 27th, 2008 at 4:32 am
ah forgot to say thanks i needed that to split a huge file i needed to give it to a friend on 2 512Mb USB-Flashs
(using linux makes u smarter )
the command i figured it out because it’s dos equivalent to cat
it’s better like that then to use zip multipart, it’s make u cooler in your friends eyes
September 15th, 2008 at 1:54 pm
[...] split -b200m book.rar book-split Here 200m is 200 MegaByte book.rar is the source file to be splitted. and book-split is prefix of generated file. To restore the file: cat book-split* > NEWFILENAME Source: http://www.computerhope.com/unix/usplit.htm http://www.techiecorner.com/107/how-to-split-large-file-into-several-smaller-files-linux/ [...]