Tar.xz

From PCLinuxOS Knowledgebase
Jump to navigation Jump to search

About Tar.xz

xz is a lossless data compression program and file format. From command tar --help

-J, --xz              filter the archive through xz

How can you pack file to tar.xz from terminal ?

tar -cf - forder_name/ | xz -9 -c - > file_name.tar.xz

( we suggest copy, paste and edit command than rewrite )

How can you unzip tar.xz from terminal?

tar xvfJ name_package.tar.xz  

How extract tar files to specific or different directory from terminal ?

You need use -C

tar xf name_package.tar.xz -C /path/to/dir/ 


How extract without first directory and to different directory ?

You need use --strip=1

tar xvfJ name_package.tar.xz --strip=1 -C /path/to/dir/

   Where,
       x = extract 
       v = verbose 
       f = use archive file 
       -J , --xz = archive xz 
       --strip = number leading components from file names on extraction 
       -C , --directory = change directory ( for unpack )