File Compression in Linux

Posted 卡斯柏的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了File Compression in Linux相关的知识,希望对你有一定的参考价值。

Compress an Entire Directory or a Single File

Use the following command to compress an entire directory or a single file on Linux. It’ll also compress every other directory inside a directory you specify–in other words, it works recursively.

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Here’s what those switches actually mean:

  • -c: Create an archive.
  • -z: Compress the archive with gzip.
  • -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful.
  • -f: Allows you to specify the filename of the archive.

Let’s say you have a directory named “stuff” in the current directory and you want to save it to a file named archive.tar.gz. You’d run the following command:

tar -czvf archive.tar.gz stuff

Or, let’s say there’s a directory at /usr/local/something on the current system and you want to compress it to a file named archive.tar.gz. You’d run the following command:

tar -czvf archive.tar.gz /usr/local/something

技术分享

以上是关于File Compression in Linux的主要内容,如果未能解决你的问题,请参考以下文章

python 安装 setuptools Compression requires the (missing) zlib module 的解决方案

NotImplementedError: The pixel data with transfer syntax JPEG 2000 Image Compression (Lossless Only)

NotImplementedError: The pixel data with transfer syntax JPEG 2000 Image Compression (Lossless Only)

linux之压缩归档,tar

443. String Compression

[LC] 443. String Compression