Updated: 30 September 2026 · Applies to: zip and unzip on Ubuntu 24.04, Debian 13, AlmaLinux and Rocky Linux 9
zip and unzip create and open .zip files, the format Windows and macOS use too. We tested every command on Ubuntu 24.04 and AlmaLinux 9.
Install
sudo apt install zip unzip # Ubuntu, Debian sudo dnf install zip unzip # AlmaLinux, Rocky Linux
Create a zip file
zip archive.zip file1.txt file2.txt # some files zip -r site.zip public_html # a folder with everything in it zip -r site.zip public_html -x "*.log" # leave out log files
Unzip
unzip site.zip # into the current folder unzip site.zip -d /tmp/restore # into another folder (created if missing) unzip -l site.zip # list the contents without extracting unzip -o site.zip # overwrite existing files without asking unzip site.zip "public_html/wp-config.php" # just one file
Password-protected zip files
See how to create a password-protected zip file; 7z gives stronger AES encryption than classic zip.
Zip or tar?
Use zip when the file goes to Windows or macOS users. For backups on Linux servers, tar.gz keeps file owners and permissions: see how to extract a tar file to a specific directory.
In cPanel
In File Manager, select files and click Compress, or select a zip file and click Extract.