This article was co-authored by wikiHow staff writer, Travis Boylls. Travis Boylls is a Technology Writer and Editor for wikiHow. Travis has experience writing technology-related articles, providing software customer service, and in graphic design. He specializes in Windows, macOS, Android, iOS, and Linux platforms. He studied graphic design at Pikes Peak Community College.
The wikiHow Tech Team also followed the article's instructions and verified that they work.
This article has been viewed 78,025 times.
Learn more...
Zip files are one of the primary file types for archiving and compressing multiple files into one directory. All operating systems have the ability to make Zip files, and you can easily do this in Linux as well. This wikiHow article teaches you how to make and unzip a zip file in Linux/UNIX/Mac.
Steps
Using the Terminal
-
1Press Ctrl+Alt+T to open the Terminal. The Terminal is where you can enter command-line functions in Linux. It is available in all Linux distributions. Press Ctrl + Alt + T to open the Terminal.
- On most Linux distributions that have a graphical user interface, you can open the terminal by opening the Apps menu and clicking on the icon that resembles a black screen with a white text cursor.
-
2Install Zip. Zip does not come pre-installed on all Linux distributions, type the following command and press Enter to install Zip on Linux:
- Ubuntu and Debian: sudo apt install zip
- CentOS and Fedora: sudo yum install zip.
Advertisement -
3Navigate to the folder that contains the file or folder you want to zip. To do so, type cd followed by the path that contains the file or folder. and press Enter.
- For example, if the file you want to zip is in your "Documents" folder, you would type cd Documents and press Enter.
-
4Type zip zip_file.zip file1 file2 file3 and press Enter. Replace "zip_file.zip" with the name of the zip file you want to create. Replace "file1," "file2," and "file3" with the names of the files or folders you want to compress into a zip file. Then press Enter.[1]
- This command will not work if there is a space in the file name or folder you want to zip.
- You can add as many files and folders to the end of the command as you want.
- Add -r after "zip" in the command to include all subfolders in a folder to the zip file. For example zip -r zipfile.zip folder
- Add -e after "zip" in the command to add a password to the zip file. You will then be asked to enter and verify a password.
-
5Type unzip zip_file.zip and press ↵ Enter to unzip a file. Replace "zip_file.zip" with the actual name of the zip file.[2]
Using the Graphical User Interface
-
1Open the Files app. Each distribution of Linux is a little bit different. These steps may be a little different on your Linux distribution but should be fairly similar. Click the icon that resembles a folder to open the Files app or whichever file browser app you are using.
-
2Navigate to the file or folder that you want to zip. You can zip an entire folder or an individual file. Use the file browser to navigate to the file or folder you want to compress into a zip file.
-
3Right-click the file or folder you want to zip. This displays a context menu.
-
4Click Compress. It's in the context menu. On some Linux distributions, this might say "Archive," "Zip," or something similar.
-
5Type the name of the zip file you want to create. Enter the name of the file you want to create in the space below "Archive Name."
- Some Linux distributions may use a default name instead of allowing you to enter a name for the file you are creating.
-
6Click the radio option next to "Zip. It's the first option below the field with the archive name.
- Alternatively, you can select ".tar.xz," which is a compressed archive format used by LInux computers. You can also select ".7z," which is a 7-zip file. 7-zip is an open-source version of Winzip.
-
7Click Create. It's either in the upper-right corner or lower-right corner of the dialogue box. On some distributions, this may say "Ok" or something similar. This creates a zip file of the file or folder.
Warnings
- If you zip up a file, change it, and then try to unzip it up, it will ask you if you want to replace the modified file with the file in the zip file.⧼thumbs_response⧽
References
About This Article
1. Open the Terminal.
2. Type "sudo apt install zip" and press Enter to install ZIP.
3. Type "cd" followed by the path of the file or folder you want to zip.
4. Type "zip zip_filename.zip filename1 filename2 filename3" and press Enter.