I am trying to extracting a tarball with this sort of internal structure (simplified)
[edit: added toplevel dir] some_tarball.tar └── some_tarball/ ├── bin/ │ ├── a │ └── b └── share/ └── man/ └── man1/ ├── a.1.gz └── b.1.gz With the intention of installing this to /bin and /share dirs, I used the command sudo tar xzf some_tarball.tar --strip-components 1 -C /.
However, this ended up overwriting the entire directories with its contents (i.e. /bin only contains a and b afterwards) rather than merging the contents together. In the Overwrite control section of tar manpage, it seems to be only about overwriting existing files and the metadata of dirs, which is not the case.
Is there any way I can make tar demonstrate rsync-like behavior here? Thanks in advance!
P.S.: My /share is a symlink to /usr/share, if that matters.
/binyour system would be pretty much dead. Arerm,cp,catetc. still working? What are you trying to achieve with the component stripping?ls -a /bin). I just now grabbed my installation media, mounted the squashfs partition and recovered it. As for the stripping, it is because of the presence of the toplevel directory in the tarball. Otherwise it would create/some_tarball, for example. (Sorry, I omitted that for simplicity in the tree structure)cpormv. But that tar-behavior is not right - And I couldn't reproduce it. Any odd aliases?cpormvas the other mentioned.