Linux compress-Befehl
Linux Command大全
Der Linux compress-Befehl ist ein sehr alter Unix-Dateikomprimierungsbefehl. Komprimierte Archive erhalten eine .Z-Dateierweiterung, um sie von nicht komprimierten Dateien zu unterscheiden. Komprimierte Archive können mit uncompress entpackt werden. Um mehrere Archive in ein komprimiertes Archiv zu komprimieren, müssen die Archive zunächst mit tar gepackt werden. Da gzip eine bessere Komprimierungsrate erzeugt, verwenden die meisten Menschen inzwischen gzip als Komprimierungstool.
Syntax
compress [-dfvcV] [-b maxbits] [file ...]
Parameter:
- c Schreibe das Ergebnis auf die Standardausgabe (normalerweise der Bildschirm)
- f Zwingt die Datei zu schreiben, falls das Zielarchiv bereits existiert, wird es überschrieben (force)
- v Zeige Programmexecutionsmeldungen auf dem Bildschirm (verbose)
- b Setze die Obergrenze der gemeinsamen Zeichenketten in Bits, mögliche Werte sind 9 bis 16 bits. Da ein höherer Wert mehr gemeinsame Zeichenketten ermöglicht und daher eine größere Komprimierungsrate, wird in der Regel der Standardwert verwendet 16 bits (bits)
- d Entpacke das Komprimierungsarchiv
- V Zeige Versionsinformationen
- Beispiel:
- Komprimieren Sie source.dat zu source.dat.Z, falls source.dat.Z bereits existiert, wird der Inhalt durch das Komprimierungsarchiv ersetzt.
- compress -f source.dat
- Compress source.dat into source.dat.Z and print the compression ratio.
- -v and -f can be used together with
- compress -vf source.dat
- After outputting the compressed data, it can be imported into target.dat.Z to change the name of the compressed file.
- compress -c source.dat > target.dat.Z
- -The larger the value of b, the higher the compression ratio, ranging from 9-16 , the default value is 16 .
- compress -b 12 source.dat
- To unzip source.dat.Z into source.dat, if the file already exists, the user must press y to confirm overwriting the file, if using -The df program will automatically overwrite the archive. Since the system will automatically add .Z as the extension name, source.dat will be automatically treated as source.dat.Z.
- compress -d source.dat
- compress -d source.dat.Z
Online Examples
Compress File
[[email protected] ~]# compress abc.h
[[email protected] ~]# ls
abc.h.Z
Unzip File
[[email protected] ~]# compress -d abc.h.Z
[[email protected] ~]# ls
abc.h.
Compress according to the specified compression ratio
[[email protected] ~]# compress -b 7 abc.h
Forcefully Compress Folder
[[email protected] ~]# compress -rf /home/abc/
Linux Command大全