![]() $ tar -xz -cf - /path/to/dir | ssh "cat > filename.txz" Conclusion $ tar -cJvz - /var/www/html | nc server-ip-here 4242 On other side compress directory to stdout and send to the nc, run: Let us uncompress tar directory from stdin sent from the nc, enter (assuming that target server-ip protected by VPN else use the ssh command): Of coruse we can uncompress and send content to stdout for the mysql command too $ sudo tar -xz -cvf /efs/backups/aws-us-west-xz in action Compress from stdin The syntax is as follows for compressing per-existing tarball:Īlternatively, use the tar command for convenience purposes tar.xz fileĬompress a file named mysql.sql and replace it by for saving disk space: tar.xz fileĭecompress file named and replaced by mysql.sql: Let us see some tips and tricks for xz command. Tar internally calls xz itself or using API provided by libs. But, we can use xz command directly for as compressor and decompressor too. So far, we learned to use tar for extracting. webp images I would pass -wildcards '*.webp' option to the tar. Therefore, to extract files, use the -wildcards options. -wildcards : By default, wildcards don’t work as they treated or processed to by your current shell.Hence, we install xz using package manager. -J OR -xz : Filter the archive through xz command.-f : Use this archive file or device archive for extracting files. ![]() -x : Extract/get/unzip files from an archive.$ tar -wildcards '*.pl' -xvf centos-7-sysadmin-scripts.txz Understanding tar command options Want to extract all Perl or Python source code files? Try the following option: Sample outputs: drwxrwxr-x root/root 0 11:29 linux-5.6.13/ $ tar -tvf | egrep ' file.txt| data.doc| cake.jpg' # filter out tar listing option using the grep command/egrep command # Hence, we list the contents of an archive by passing the -t as follows and then unzip tar.xz files: Sometimes we don’t know file names in advance. $ tar -xf babys-3rd-cake-day.jpg sales.txt We extract a given file names from a file by using the following syntax: ![]() We can now directly use the tar command as follows for extracting a file named linux-5.6.13.tar.xz:Įxtracting specific files from a tar.xz file $ sudo zypper install xz OpenSUSE installing xz package for extraction purposes Examples We can use the zypper command to install xz: Installing xz on OpenSUSE/SUSE Enterprise Linux Loading mirror speeds from cached hostfile The tar command works if xz installed on the system. These formats are popular among open source developers and projects due to higher compression rates than alternatives tools like gzip and bzip2. XZ is a set of open-source software for lossless data compressors, including LZMA and xz formats.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |