From the course: Linux Tips

Unlock this course with a free trial

Join today to access over 22,500 courses taught by industry experts.

Splitting and combining files

Splitting and combining files - Linux Tutorial

From the course: Linux Tips

Splitting and combining files

- [Instructor] Files are really just a bunch of bits. So if we need to, we can slice and dice a file into various parts and put them back together again. Splitting a file might be necessary to store it on a few devices that might not be able to hold the full thing. Or to make individual smaller pieces available for download, or something like that. To split a file, we use the command split. Here in my Pictures folder, I have a picture of a cat. Let's split it into a few pieces and put it back together again. He looks surprised, but it won't hurt. Here in the terminal, I'll use the command split and then specify -b. This tells split to divide the file by bytes. And I'll tell split to split this file into one megabyte chunks. Then I'll use -d, which appends decimal numbers, instead of strings to the end of each of the parts' file names. Then I'll provide the file to split, cat.jpg. And I'll provide a template for how to name the parts. In this case, we'll call them cat.jpg.part. And…

Contents