How to split large file into several smaller files - Linux

advertisement

linux, split file linuxHave 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

Technorati Tags: , , , , ,

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!

Share and Enjoy:
  • Reddit
  • BlinkList
  • del.icio.us
  • Digg
  • Fark
  • IndianPad
  • StumbleUpon
  • YahooMyWeb
Posted at March 1st, 2007 by chua

If you think this article helps you to solve your problem and clear your headache, feel free to buy me a drink :)

9 Responses to “How to split large file into several smaller files - Linux”

  1. Adam Says:

    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

  2. przemeq Says:

    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

  3. lutzfer Says:

    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.

  4. mux Says:

    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.

  5. How to compress and split into smaller files in Linux « Tech Log Book Says:

    [...] check this link. [...]

  6. ych Says:

    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?

  7. zazuge Says:

    actualy in windows you can do:
    $> type filepart1 filepart2 > filefull

  8. zazuge Says:

    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
    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 ;) (using linux makes u smarter )

  9. How to split file & restore in Linux? « JealousGuy’s unreadable blog Says:

    [...] 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/ [...]

Leave a Reply