🏘 Как извлечь файлы .xz в Linux – CentOS / Ubuntu / Debian

by itisgood

Как я могу извлечь файлы .tar.xz или .xz в моей системе Linux?

xz – программа сжатия без потерь и формат файла, который включает алгоритмы сжатия LZMA / LZMA2. Формат XZ является форматом сжатия одного файла и не предлагает возможности архивирования.

В этом руководстве мы увидим, как извлечь файлы .xz в Linux.

Процесс будет включать установку необходимых утилит и демонстрирует использование на примере.

Чтобы извлечь файлы .xz в Linux – CenOS / Ubuntu, нам нужен пакет xz-utils, установленный в системе, над которой мы работаем.

Установите пакет xz-utils в CentOS / Ubuntu / Debian

Установите пакет xz-utils, используя соответствующий менеджер пакетов для вашего Linux и соответствующее имя пакета.

--- Ubuntu / Debian ----
$ sudo apt-get install xz-utils

--- CentOS / Fedora / RHEL ---
$ yum install xz

Извлечение файлов .xz в Linux

После установки пакета распакуйте ваш файл с помощью команды:

$ unxz file.xz

или –decompress опция xz:

$ xz --decompress file.xz

Здесь поддерживаются cледующие параметры:

Usage: unxz [OPTION]... [FILE]...
Compress or decompress FILEs in the .xz format.

  -z, --compress      force compression
  -d, --decompress, --uncompress
                      force decompression
  -t, --test          test compressed file integrity
  -l, --list          list information about .xz files
  -k, --keep          keep (don't delete) input files
  -f, --force         force overwrite of output file and (de)compress links
  -c, --stdout, --to-stdout
                      write to standard output and don't delete input files
  -0 ... -9           compression preset; default is 6; take compressor *and*
                      decompressor memory usage into account before using 7-9!
  -e, --extreme       try to improve compression ratio by using more CPU time;
                      does not affect decompressor memory requirements
  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0
                      to use as many threads as there are processor cores
  -q, --quiet         suppress warnings; specify twice to suppress errors too
  -v, --verbose       be verbose; specify twice for even more verbose
  -h, --help          display this short help and exit
  -H, --long-help     display the long help (lists also the advanced options)
  -V, --version       display the version number and exit

With no FILE, or when FILE is -, read standard input.

В моем случае у меня есть файл fedora-coreos-30.20190725.0-openstack.qcow2.xz. Чтобы извлечь его, я буду использовать:

$ unxz -v fedora-coreos-30.20190725.0-openstack.qcow2.xz 
fedora-coreos-30.20190725.0-openstack.qcow2.xz (1/1)
  100 %     399.9 MiB / 1,555.3 MiB = 0.257    85 MiB/s       0:18      

Файл .xz автоматически удаляется после распаковки.

You may also like

Leave a Comment