• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

xz Command Examples in Linux

by admin

The xz command is a data compression utility, similar to gzip, that reduces the size of selected files and manages files in the .xz file format. The xz command has several options.

Option Used To
-d Decompress a file.
-f Force compression or decompression of a file even if it has multiple links or if the file exists.
-q Suppress all warnings.
-v Display the name and percentage reduction of the compressed or decompressed file.
-t Perform an integrity check on the compressed file.

Syntax

The syntax of the xz command is:

# xz [options] [file names]

xz Command Examples

1. Compress a file to the xz file format:

# xz file

2. Decompress a xz file:

# xz -d file.xz

3. Compress a file to the LZMA file format:

# xz --format=lzma file

4. Decompress an LZMA file:

# xz -d --format=lzma file.lzma

5. Decompress a file and write to stdout:

# xz -dc file.xz

6. Compress a file, but don’t delete the original:

# xz -k file

7. Compress a file using the fastest compression:

# xz -0 file

8. Compress a file using the best compression:

# xz -9 file

Filed Under: Linux

Some more articles you might also be interested in …

  1. Common Init.ora Parameters and Unix, Linux Kernel Parameters and Relationship Between Them
  2. pacman –sync Command Examples
  3. snap Command Examples in Linux
  4. make: Nothing to be done for `default’
  5. How to Install Gnome Desktop Environment onto Oracle Linux 6.x
  6. iostat Command Examples in Linux
  7. How to fix the error “host key verification failed”
  8. How to Automatically Run ntpdate When Starting NTPD in CentOS/RHEL 5
  9. mkswap Command Examples in Linux
  10. 10 useful cron examples to schedule jobs in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • powertop Command Examples in Linux
  • powertop: command not found
  • powerstat: command not found
  • powerstat Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright