If you’re a Windows user and you’ve sent / received large files over the Internet, you probably haven’t heard of the 7 Zip file compression tool. Installing 7 Zip on Windows is quite simple, so what about Ubuntu Linux. The following article Taimienphi.vn 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 extract 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.
Refer to the following article of Taimienphi.vn 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 following command:
sudo apt-get install p7zip-full p7zip-rar
2. Using 7 ZIP on Ubuntu Linux
The p7zip package installs a command line utility named 7z. Here is the syntax:
7z [adeltux] [-] [SWITCH] …
To make it easier to imagine, below Taimienphi.vn will explain how to use 7 ZIP on Ubuntu Linux.
To begin, we first learn how to create an .7z archive using this command. Suppose you have a folder named files containing 4 files in it.
The task is to encapsulate these 4 files in a .7z file. To do this, enter your files directory into the command line and execute the following command:
$ 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 deleted 4 files in the current files directory.
And you want to get back these files by unzipping the compressed .7z file you just created. To do this, we use the command line option “e“as in the command below:
7z e files.7z
Above are the basic steps to create and extract a zipped file using 7z tool on Ubuntu Linux.
Next suppose if you need to create a .zip file. To do this, use the following command:
7z a [zipfile-name] [files-to-be-zipped]
In addition, the 7zip tool also allows users to easily access compressed files (archive files) after creation. For example, suppose that you have just created a zip file and found that you need to add some files or directories to the archive. Instead of deleting the old zip file 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 directory contains a total of 5 text files and you want to add file5 to the compressed file.7z. To do this, use the “u” option in the 7zip command:
To confirm the compressed file has been updated, simply double-click on the file to open it. Alternatively you can do this via the command line, using the “l“in the 7z command:
In the screenshot above, you can see the 7z command confirms that the compressed file.7z 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 also do this. In this case, we use the command line option “d“. The overall syntax of the command looks like the following:
7z d [archive-name] [file-to-be-deleted]
Note you must add conversions “r“enter the command in case the file in question is located in the compressed subdirectory.
Here are some important notes that you need to remember when using 7z utility:
– Do not use the 7-zip format for backup on Linux / Unix because 7-zip does not store users / groups of files.
– On Linux / Unix, to back up directories, you must use the command tar:
+ To back up a directory, use the command tar cf – directory | 7za a -si directory.tar.7z
+ To restore a backup using the command: 7za x -so directory.tar.7z | tar xf –
– If you want to send files and directories (other than file owners) to other Unix / MacOS / Windows users, you can use the 7-zip format.
– Do not use the “r“.
– Do not use folder/* because of the “. *“does not match”/ .profile directory“).
The article above Taimienphi.vn has just taught you how to install and use 7 ZIP on Ubuntu Linux. Also, if you have any questions or need answers like How to decompress RAR file on Linux or Unix, readers can leave your comments in the comment section below the article.