How to Zip and Unzip a directory and its files in Linux?

To zip a directory and its files in Linux, you can use the zip command. Here is an example:

zip -r archive.zip directory

This will create a file called archive.zip that contains all the files and directories in the directory folder.

To unzip a zipped file in Linux, you can use the unzip command. Here is an example:

unzip archive.zip

This will extract all the files and directories from the archive.zip file into the current directory.

If you want to extract the files into a specific directory, you can use the -d option followed by the path to the directory you want to extract to. For example:

unzip archive.zip -d /path/to/directory

This will extract the files and directories from the archive.zip file into the /path/to/directory folder.

Related Solutions