Does anyone know the actual command-line syntax for pulling a directory tree out of a .tgz file? There is some small formatting thing I’m missing, and I know this directory tree is in that .tgz file. Some web links say to use quotation marks, others not. I’ve yet to find one with an actual example of this. Am I missing a wildcard? None of the examples I found online had a wildcard or a “recursive” (-r) in the example.
user1> tar -xzvf data_backup.tgz /home/user1/.mozilla/firefox/
tar: /home/user1/.mozilla/firefox: Not found in archive
tar: Exiting with failure status due to previous errors
user1>
You need to provide name as stored in tar archive. GNU tar strips leading / by default as example. If you are not sure, just list archive content and look for actual name.
Depends on the shell being used – for example, for the case of “bash” –
Enclosing characters in single quotes preserves the literal value of each character within the quotes. A single quote may not occur between single quotes, even when preceded by a backslash.
Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, , and, when history expansion is enabled, !.
Personally, I tend to use single quotes when the at least one of characters { } % appear in a command’s parameters and, for things such as the value to be associates with the “find” parameter “-name” …