utility-option

tar -xf

Restore an archive created by the same fixture into a new private directory; never use this example on an untrusted archive.

Formal Syntax & Structure

bash syntaxbash
tar -xf ARCHIVE -C DESTINATION

Return Value

exit status

Restore an archive created by the same fixture into a new private directory; never use this example on an untrusted archive.

Working Example

Example Snippetbash
mkdir source restoreprintf 'hello\n' > source/note.txttar -cf backup.tar -C source note.txt || exit 1tar -xf backup.tar -C restore || exit 1cmp -s source/note.txt restore/note.txt || exit 1printf 'restore verified\n'
Bash Reference