How to zip a folder in Ubuntu Linux / Debian Linux
I am a new Ubuntu Linux user. I would like to compress a folder named data in my home directory. How do I zip a folder in Ubuntu Linux? How do I compress a directory in Ubuntu Linux?
To compress archive files use zip command. The zip is a compression and file packaging utility for Linux and Unix command. A companion program called unzip unpacks zip archives. This page shows how to compress a folder on Ubuntu Linux or Debian Linux using the CLI and GUI methods.
zip a folder in Ubuntu Linux using the cli
First install the zip command using apt command or apt-get command. Open the terminal and type the following command: $ sudo apt install zip unzip
How do I use zip command to compress a folder?
The syntax is zip -r filename.zip folder zip -r filename.zip folder1 folder2 zip -r filename.zip /path/to/folder1 /path/to/file2 To create compressed archive named data.zip of data folder in the current directory, run: zip -r data.zip data/ Verify file with the ls command: ls -l data.zip You can encrypt data.zip with a password by passing the -e option: zip -r -e data.zip data/ Sample outputs:
store symbolic links as the link instead of the referenced file
don’t compress these suffixes
show more help
Compress a directory in Ubuntu Linux
The zip command syntax is as follows to compress a directory in Ubuntu Linux: zip -r compressed_data.zip /path/to/foldername zip -r compressed_data.zip /home/vivek/Jan-2018
zip a folder in Ubuntu Linux using the GUI method
To access and organize your files you use “Files” app (file manager)”. Use the Files file manager to browse and organize the files on your computer. Open it. Select folder name such as data and right click the “Compress…“:
You just learned how to compress a directory in Ubuntu Linux or Debian Linux using the zip command. The same command used to zip a folder in Linux. For more info please see this page here.
The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.