Learn how straightforward it’s to create compressed archives from the Linux command line, utilizing zip. Jack Wallen exhibits you the way.
Not too long ago, I confirmed you the right way to create compressed archives from the Linux command-line utilizing the tar command. This time I need to reveal the identical process, however utilizing a software you are most likely already conversant in. The software in query is zip, and it creates compressed zip information from no matter you throw at it.
SEE: 5 Linux server distributions you have to be utilizing (TechRepublic Premium)
So, for instance you may have the folder TEST and also you need to create the compressed file TEST.zip so you’ll be able to ship it to a colleague. Thankfully, Linux can use the zip software, however first, you might need to put in it with a command like sudo apt-get set up zip -y or sudo dnf set up zip -y.
As soon as put in, zip is able to go. Let’s compress that TEST folder. The way you create the zipped file is not fairly so simple as you may assume. The fundamental command is zip NAME.zip NAME (the place NAME is the title of the folder to be compressed). Nonetheless, in the event you merely issued the command zip TEST.zip TEST, you’d wind up with a file named TEST.zip, however after uncompressing it, you’d discover it is lacking the contents.
Why? Since you solely compressed the folder, not the contents.
To incorporate the contents of the TEST folder, you’d add the recursive flag, as in zip -r TEST.zip TEST.
SEE: Rust: What builders must learn about this programming language (free PDF) (TechRepublic)
If you problem the command with the -r flag, you may see zip provides each file inside the listing to the compressed file. This time, in the event you decompress the file, with the command unzip TEST.zip, the contents of the listing stay intact.
And that is all there’s to creating compressed archives from the Linux Command Line Interface, utilizing the zip software.
Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the most recent tech recommendation for enterprise professionals from Jack Wallen.