One of the common command skills in the UNIX platform, compression and decompression

xiaoxiao2021-03-06  63

One of the common command skills in the UNIX platform, compression and decompression

Li Shouliang 2003-2-10

There are problems with some uninparative and pressing packages under UNIX. In general, a number of files or folders is typed as a TAR package, which is to facilitate the transmission and management of the file. For example, the folder from the UNIX platform is downloaded from the UNIX platform to the Windows platform or another UNIX platform, although the folder is not too big, but because each file is small, there are very many, each file must be filed. Head, tail inspection verification. The download speed will be very slow. If you become a TAR package, the transmission will be much faster. The archived folder is also easy to manage.

It is worth noting that the TAR file is only packaged in the file or folder and is not compressed. If there is more text files, it saves a lot of disk space for its compression, and the transfer will be faster. The compression and decompression method can refer to the example given below.

Below I take Sun Solaris 5.8 (Other UNIX, like Linux, AIX) as an example, for some of the common problems, I will introduce all of you, for everyone to refer to the reference. Because of the limited level, only the brick introduction, welcome everyone to actively supplement.

1. How to unwield .tgz or .tar.gz file?

2, how to solve the .z or .z file?

3, how to solve the .tar.z file?

4, how to install, uninstall, list RPM package information? (Linux is common)

5, how to use the tar command test, expand, generate TGZ packets?

6, how to unwield and generate a tar file?

7. How to decompose package software like ARJ on the PC?

8, how to compress files under UNIX?

9. How to unwield and generate other packages such as .jar files?

10, throwing bricks, waiting for the same

============================================================================================================================================================================================================= ==========

1. How can I solve the .tgz or .tar.gz file?

1) Method 1:

Gzip -d filename.tar.gz or gzip -d filename.tgz

Tar-xvf filename.tar

2) Method 2:

Unzip and list:

Gzip -dc filename.tgz | tar xvf - # 解 .tgz file

Gzip -dc filename.tar.gz | tar xvf - # .tar.gz with .tgz file

Only list does not generate files:

Gzip -dc filename.tgz | TAR TVF - # 解 .tgz file

Gzip -dc filename.tar.gz | tar tvf - # .tar.gz with .tgz file

See gzip-h in other ways of gzip

============================================================================================================================================================================================================= ========== 2, how can I unope the .z or .z file?

1) Solution .z file: gzcat filename.z

2) Solution .z file: uncompress -c filename.z

============================================================================================================================================================================================================= ==========

3, how to solve .tar.z file?

1) Unzip and list:

Zcat filename.tar.z | tar xvf - # 解 .tar.z file

Uncompress -c tast.tar.z | xvf - #UNcompress -c with zcat

2) Only list does not generate files:

Zcat filename.tar.z | TAR TVF - # 解 .tar.z file

Uncompress -c filename.tar.z | TVF - #UNcompress -c with zcat

============================================================================================================================================================================================================= ==========

4, how to install, uninstall, list RPM package information? (Linux is common)

1) Display progress when installing the RPM package

For example: use -VH parameters such as rpm -ivh ipchains-1.3.6-1.i386.rpm

2) Install the RPM package directly through FTP

For example: rpm -i ftp://ftp.xxx.xxx

3) Check all RPM packages to find lost files

For example: rpm -va

4) Find a file that belongs to which RPM package

For example: rpm -qf / usr / bin / who

5) List the description of an RPM package

For example: rpm -qpi mon-0.37j-1.i386.rpm

6) List the file information of an RPM package

For example: rpm -qpl mon-0.37j-1.i386.rpm

7) List and filter the installed package

For example: rpm -q | grep ibm

8) Delete the installed package

For example: rpm -e package name

9) Other RPM operations See #rpm --help

============================================================================================================================================================================================================= ==========

5, how to use the tar command test, expand, generate TGZ packets?

TAR ZVFX FileName.tgz # Expand this package in the current directory

TAR ZVFT FileName.tgz # only tests do not expand

TAR ZVFX FileName.tgz -c / new-dir # After the / new-dir directory

TAR ZVFC filename.tgz / filename # Pack all files and subdirectories in / filename directory into filename.tgz

============================================================================================================================================================================================================= ==========

6, how to unwield and generate a tar file?

TAR XVF filename.tar # When the first directory unpack

TAR TVF filename.tar # only shows no file

TAR CVF filename.tar # generation package

There are a lot of TAR's parameters, you have to study carefully to see #tar -h

============================================================================================================================================================================================================= ==========

7. How to decompose package software like ARJ on the PC?

# slent -b 100k big.file

Decompose BIG.FILE into a few 500K small files (named xa, xb, xc, ...)

# slent -l 500 BIG.FILE

Decompose BIG.FILE into small files for each 500 Lines

See Split-H in other ways

============================================================================================================================================================================================================= ========== 8, how to compress files under UNIX?

There are a variety of compressed methods under UNIX, see tool documents such as Gzip, Gunzip, Zcat, Compress, and some of the methods described above. The following is only an example of a compress command:

For example: need to pack / filename's files and compress, you need to do the following steps:

1) Package TAR CVF filename.tar ./dir

2) Compression

Compress filename.tar # generation filename.tar.z file

If you restore the original directory structure

1) decompression

Uncompress filename.tar.z

3) Solution Tar Package

TAR XVF filename.tar

If the UNIX command parameter is not familiar, it is generally possible to transmit compression or package files to the PC via FTP, and unlocked with WinD or RAR and other compression tools under Windows.

============================================================================================================================================================================================================= =========

9. How to unwield and generate other packages such as .jar files?

Generate a summary of the JAR package and the operation of the TAR package is similar to the Unix.

E.g:

JAR CVF filename.jar / dirname # 打 / / 成 j

JAR XVF filename.jar # unpacking JAR package

Jar TVf filename.jar # only lists JAR package

============================================================================================================================================================================================================= =========

10, to be supplement

Li Shouliang

2003-2-10

转载请注明原文地址:https://www.9cbs.com/read-106530.html

New Post(0)