Does tar -x by default just extract to the current directory or does it try to reproduce the original directory structure including overwriting the original source? I know I can specify a folder to extract to by using -C directory/ but I am asking about it's default behavior.So if I used tar -cvpjf ~/backup.tar.bz2 / to make a backup of my root directory and I then extract the backup.tar.bz2 (assuming I had root privileges) from within my home directory would it recreate / in my home directory or would it actually try to overwrite /?
Does tar -x Extract to Current Directory or Does it Extract to the Source of the Archive?
directory;filenames;tar
Historically, if the paths in the archive were absolute, then they were extracted at the absolute location referred to in the archive. Some tar implementations offer an option to convert those to relative (/foo/bar becomes ./foo/bar) and some like GNU tar even make it the default.So, in short, it depends on your tar implementation. You should look at the manual for your tar on your own system.