۱۹
دی
want to extract tar file to specific directory called /tmp/data. How can I extract a tar archive to a different directory using tar command on a Linux or Unix-like systems?
You do not need to change the directory using cd command and extract files. Untarring a file can be done using the following syntax:
Syntax
Typical Unix tar syntax:
tar -xf file.name.tar -C /path/to/directory
GNU/tar syntax:
tar xf file.tar -C /path/to/directory
tar xf file.tar --directory /path/to/directory