How to split compressed files using the terminal

Split Zip files

If I had to say which operating system I am most comfortable with, I think I would only have one thing clear: that operating system would not be Windows (and I am not saying that for the sake of saying). Mac and Linux can do practically everything as soon as you install the operating system, such as splitting files with a tool called Split. This tool, available by default in many Linux distributions, will allow us to divide compressed files from the terminal, the most used application in the Linux community.

Split files with Split it is not very difficult. The only thing we have to know is that it will work only with compressed files. With this clear, what we have to do is open the terminal, move to the path where the compressed file is and write the command split [OPTION] [ORIGINAL_FILE] "[TEXT_TO_ADD_BACK]". As I know that the above can be a bit confusing, below you have an example that will clarify everything.

How to use Split to split files

Good. For this test, I have compressed several folders in my «Music» folder into a file of about 2GB that I have called «Music.zip». To compress the file, I had to open the terminal and type two commands:

cd ~/Música

split -b 600M Música.zip "prueba.zip.part"

I have written both commands with the initial of «Music» in capital letters and with an accent on the «u». Once inside the «Music» folder, we already write the command as I have written it, where:

  •  split: main command.
  • -b: option to divide.
  • 600M: maximum size of the divided files. For this example I have put 600MB. Keep in mind that to indicate what we want to divide the file into, we have to use the letter M for if we want it to be in MBs or K if we want it to be in KBs.
  • Music.zip: file I want to split.
  • "Test.zip.part": you have to put it in quotation marks, it is the name that I want the divided files to have and what extension they will have. The .part extension is used by many applications to join files.

If we want to check directly from the terminal if the files have been created, we can do it using the command «ls -lh», for which in the previous example it would be:

ls -lh prueba.part*

Do you already know how to divide files from the terminal in Linux?


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.