Software recommendation: Linux in the use of command-line view compressed documents

The usual way to view the contents of a zip file is to decompress it and then view it one by one. If there are a lot of files in a zip file, it is very inconvenient to unzip it and then view it. For those who use Linux system, you can now use the command line to view the zip file directly. Let’s take Kirin Ubuntu system as an example.

Use the command line directly from the local area

Command line is the main operation carrier of Linux, for common formats of compressed files, we can directly use the system comes with the command line to complete the compressed package view. For example, many documents under linux are compressed using the .tar format, if you want to view such compressed packages, first start the MATE terminal, then enter the command “tar -tf /home/yumufa/download/qq.tar” in the terminal, so you can You will see the files in the zip file (Figure 1).

201820cbys1

Figure 1 tar to view the contents of the zip file

If it is a zip file, type “zip -sf /home/yumufa/downloads/qq.zip” directly in the terminal to view it. Similar built-in commands are zcat, gzip, less, etc. The use of these commands is similar, just enter the corresponding command + parameters in the terminal to complete the view of the compressed package, for example, enter “less /home/yumufa/download/qq.tar”, you can view the contents of the tar tarball (Figure 2).

201820cbys2

Figure 2 Using the less command to view the zip archive

Ready to use, using third-party command line

Some zip formats do not have a built-in command line in Linux for reasons such as copyright, but for those that cannot be viewed with the built-in commands, you can install them in Linux out of the box.

For example, for .rar files, just type “sudo apt install rar” in the terminal and enter the administrator password as prompted, then you can download and install the rar command (Figure 3). Of course, if the installation cannot be completed from the command line, many Linux systems now have software installation center components that we can search and install on our own.

201820cbys3

Figure 3 Install rar command

After completing the installation command, continue typing “rar /home/yumufa/download/qq.rar” in the terminal to view the contents of the rar archive (Figure 4).

201820cbys4

Figure 4 View the contents of the rar archive

Leave a Comment