Install and use 7 ZIP on Ubuntu Linux
If you are a Windows user and you have ever sent/received large files online, you probably have not heard of the 7 Zip file compression tool. Installing 7 Zip on Windows is quite simple, so what about on Ubuntu Linux. The article below TipsMake will guide you how to install and use 7 Zip on Ubuntu Linux.
In addition to the 7z format, the 7 ZIP tool also supports compression of other file formats such as XZ, BZIP2, GZIP, TAR, ZIP and WIM. Besides, users can use the tool to decompress files such as AR, ARJ, CAB, CHM, CPIO, CramFS, DMG, EXT, FAT, GPT, HFS, IHEX, ISO, LZH, LZMA, MBR, MSI , NSIS, NTFS, QCOW2, RAR, RPM, SquashFS, UDF, UEFI, VDI, VHD, VMDK, WIM, XAR and Z.
Continue reading TipsMake's article below to learn how to install and use 7 ZIP on Ubuntu Linux.
1. Install 7 ZIP on Ubuntu Linux
To download and install the p7zip tool on Ubuntu Linux, use the command below:
sudo apt-get install p7zip-full p7zip-rar
2. Use 7 ZIP on Ubuntu Linux
The p7zip package installs a command-line utility called 7z. Below is the syntax:
7z [adeltux] [-] [SWITCH] .
To make it easier to imagine, below TipsMake will explain how to use 7 ZIP on Ubuntu Linux.
To get started, let's first learn how to create a .7z archive using this command. Suppose you have a folder named files containing 4 files in it.
The task is to package these 4 files in a .7z file. To do this, enter your files directory into the command line and execute the command below:
$7z a files.7z *
The screenshot below shows how the command is working:
After the above command runs successfully, a file named files.7z will be created in your current working directory.
Suppose if you accidentally/intentionally delete 4 files in the current files folder.
And you want to get these files back by decompressing the .7z compressed file you just created. To do this, we use the command line option " e " as shown in the command below:
7z e files.7z
Above are the basic steps to create and decompress compressed files using the 7z tool on Ubuntu Linux.
Next suppose if you need to create a .zip file. To do this, use the command below:
7z a [zipfile-name] [files-to-be-zipped]
For example:
In addition, the 7zip tool also allows users to easily access compressed files (archive files) after creation. For example, suppose you have just created a compressed file and discover that you need to add certain files or folders to the compressed file. Instead of deleting the old archive you just created and creating a new one, you just need to update the archive you just created with the files and folders you want to add.
For example, suppose the file folder contains a total of 5 text files and you want to add file file5 to the compressed file files.7z. To do this, use the "u" option in the 7zip command:
To confirm the compressed file has been updated, just double click on the file to open it. Alternatively you can do this via the command line, using the " l " option in the 7z command:
In the screenshot above, you can see that the 7z command confirms that the files.7z archive has just been updated with the new text file.
If you want to delete certain files in the compressed file created by 7z, you can do this too. In this case, we use the command line option " d ". The overall syntax of the command is as follows:
7z d [archive-name] [file-to-be-deleted]
Note that you must add the " r " switch to the command in case the file in question is in a subfolder of the archive.
Important note
Here are some important notes that you need to remember when using the 7z utility:
- Do not use 7-zip format for backup on Linux/Unix because 7-zip does not store users/groups of files.
- On Linux/Unix, to backup folders, you must use tar command:
+ To backup a directory, use the command tar cf - directory | 7za a -si directory.tar.7z
+ To restore a backup use the command: 7za x -so directory.tar.7z | tar xf -
- If you want to send files and folders (not the file owner) to other Unix / MacOS / Windows users, you can use the 7-zip format.
- The " r " option should not be used .
- Do not use directory/* because " .* " files do not match " directory/.profile ").
The above article TipsMake has just shown you how to install and use 7 ZIP on Ubuntu Linux. In addition, if you have any questions or concerns like how to extract RAR files on Linux or Unix, readers can leave their comments in the comments section below the article.
You should read it
- How to install Steam in Ubuntu
- How to Install Ubuntu Linux
- 5 things to do when installing Ubuntu on PC
- Instructions to install Ubuntu directly from the hard drive
- How to install Pip in Ubuntu
- How to troubleshoot Ubuntu problems does not start
- How to Install Steam on Linux
- How to install fcgiwrap for Nginx on Ubuntu 20.04
- How to install and remove fonts on Linux
- How to install VPN on Ubuntu
- 8 ways Ubuntu changes and improves Linux
- How to install GIMP on Ubuntu 18.04