MacMost Q&A Forum • View All Forum QuestionsAsk a Question

How Do I Make, and Find, a ZIP File Using Terminal?

Attempted to make a Zip file in terminal (Catalina 10.5.6 27in 4k iMac) with the zip -er command as explained in online instructions.
Firstly I had difficulty in getting the path correct, placing the file on the desktop and using drag and drop worked, but not ideal. Then when Terminal finally seemed happy, and listed the files in its window as Deflated, it stopped at the standard input line with no information. So 1, did it make a zip file? and 2, where does it put it? Can’t tell if it worked as I can’t find it if it exists. Help please
Chris Wilder

Comments: One Response to “How Do I Make, and Find, a ZIP File Using Terminal?”

    4 years ago

    The zip command is pretty straight-forward. You can always type this to see all of the help info and examples:

    man zip

    Using -e will encrypt the file. If that is what you want to do, then fine, but keep in mind it requires a password. That means it should prompt you, twice, for that encryption password.

    First, to navigate to the location of the files, use the cd command. So type cd and then drag and drop the folder from the Finder and press return. For instance, to go to the Desktop, you end up with:

    cd /Users/(your home folder name)/Desktop

    Then, just use the zip command like this:

    zip -er

    Then it will create the zip file in the same folder as the original.

    If you want to zip multiple files, the easy way is to create a folder there, put the files in it, and do the same thing with the folder.

    zip -er nameoffoldertocompress

    I think what was happening to you before was that you were somewhere else, perhaps at the root level or home folder. Then you used the full path to the file to compress. This took the file from there, but create the zip file in your current location. Using pwd will show your current location in that case. But it makes more sense to just use cd to work in the location you are dealing with in the first place.

Comments Closed.