I am a newbie in Linux. Whats is the complete process to zip and unzip a directory and its files? Please mention if any installation has to be done.
To zip a folder and it's contents recursively:
zip -r archivefile foldername
To unzip a zip file:
unzip archivefile
Several options exist, the most common ones:
On CLI (command line interface) there are the two utilities zip
and unzip
which do the obvious thing. For example to compress a directory "my-folder" with all its content using the zip algorithm you would do a zip -r my-folder.zip myfolder
. To uncompress it your would use unzip my-folder.zip
. Paths are always relative to the current working directory, so where you execute the command. Take a look at the "man page" to find out about the usage: man zip
.
There are also GUI utilities (so utilities with a graphical user interface), but it depends on what desktop environment you use, since they are typically integrated. There is ark
for KDE and a differente service menus that can be used for example in the file manager dolphin. There certainly are similar solutions for desktop environments like GNOME or Unity.
The question what packages you have to install depends a bit on the Linux distribution you use. The package names may vary slightly, but in general you certainly should be able to find the "zip" package in your local package management system.
which zip
or whereis zip
. If you get a result, that is where the utility is installed. Or, slower but also interesting, you simply check inside your local package management system if it is installed. –
Furtek I had alot of trouble using unzip giving me errors like
sql.zip has more than one entry--rest ignored
Etc.
Using php worked like a sharm. Oneliner:
php -r '$zip = new ZipArchive; $zip->open("db.sql.zip"); $zip->extractTo("./"); $zip->close(); echo "Yay!";'
Run in cmd / terminal after php is installed
© 2022 - 2024 — McMap. All rights reserved.