Ubuntu – way to `tar` extract without clobbering


Is there a way to tar extract without clobbering?

I am installing 12.04 and want to restore my data from 10.10. Anything 12.04 specific I would like to keep, that is I do not want the tar'd 10.10 version to be extracted. If I do a general restore such files as .bashrc will be clobbered. Is there a way to avoid this?

Edit: I would note that a booted 12.04 ISO disk image allows an upgrade from 10.10 (or whatever) and it offers to keep old data. I tried this but it complained some applications might be left broken after the upgrade. I decided to just reboot and do a clean install.

Best Answer

I have difficulty understanding what you want but if you made a tar file of your whole system I believe you made a very large tar file that has not a real purpose unless you completely restore the tar file. If you wanted to save your own documents you should have made a backup of those documents and nothing else.

After saying that tar has several nifty options ...


This will not overwrite existing files.


This will keep all files that have a newer timestamp as is.


This will leave the metadata of an existing directory as is.

A manual for tar can be found here.

But I would advice extracting the tar file on another medium and manually restore those files. It is the safest method.