TransWikia.com

How do I gunzip to a particular directory?

Unix & Linux Asked on November 19, 2021

I have .gz file like BIG5.gz. I want to gunzip this .gz file to the directory BIG5.

This did not work:

gunzip -c BIG5.gz > /BIG5

2 Answers

This should work on gz:

tar xvzf /dir/to/file.tar.gz -C /dir/to/output/

Answered by Divyani Singh on November 19, 2021

You can not provide a location to put the file directly. The easiest way is probably this:

mkdir -p /BIG5 && gunzip -c BIG5.gz > /BIG5/file

This will create the directory /BIG5 if it does not exist, and then extract the file to that directory, to a file called file.

You need to replace file with the name you want the extracted file to have.

This will fail when /BIG5 is an already existing file, but succeed if it is present and it is a directory.

Answered by toydarian on November 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP