Sunday, May 25, 2014

Using "tar" to extract a .gz file to a particular folder

$ tar xvfz zabbix-2.2.3.tar.gz -C test
zabbix-2.2.3/
zabbix-2.2.3/Makefile.in
zabbix-2.2.3/misc/
zabbix-2.2.3/misc/Makefile.in
zabbix-2.2.3/misc/snmptrap/
zabbix-2.2.3/misc/snmptrap/zabbix_trap_receiver.pl
zabbix-2.2.3/misc/snmptrap/snmptrap.sh
zabbix-2.2.3/misc/images/
zabbix-2.2.3/misc/images/README
zabbix-2.2.3/misc/images/png_to_xml.sh
zabbix-2.2.3/misc/images/png_classic/
zabbix-2.2.3/misc/images/png_classic/Hub_small.png
zabbix-2.2.3/misc/images/png_classic/Server.png
zabbix-2.2.3/misc/images/png_classic/README
zabbix-2.2.3/misc/images/png_classic/Network_small.png
zabbix-2.2.3/misc/images/png_classic/Printer.png
zabbix-2.2.3/misc/images/png_classic/Notebook_small.png
zabbix-2.2.3/misc/images/png_classic/Router_small.png
.....

NOTE - If the folder "test" does not exist, then tar will throw an error, e.g.

$ tar xvfz zabbix-2.2.3.tar.gz -C test1
tar: test1: Cannot chdir: No such file or directory
tar: Error is not recoverable: exiting now

No comments:

Post a Comment