Running Ubuntu 17.04, I was installing a software from non-repository distribution, I was supposed to move the software bin -folder contents to /usr/bin (which was already iffy advice)
It's one of those days, so what I did instead:
mv /bin/* /usr/bin
So I screwed up and I accidentally moved all the files in bin to /usr/bin and /bin was empty. Since I take that /bin is system critical, for quick remedy, I copied /usr/bin contents to /bin.
Now my /bin and /usr/bin contents identical and both contain the files originally in /bin and /usr/bin separated.
- Is my Ubuntu in a broken state now? (Did not try to reboot the computer yet, right now everything seems to still work)
- Is there a way to know which files have been moved/copied to /usr/bin most recently, so I could just manually take care of the situation?
2.1 Are there usually overlapping files in /bin and /usr/bin - Is there other ways to undo what I did?
I don't have Timeshift installed so restoring backups is not an option, but there's nothing critical on the computer currently, so I could just admit to screwup reinstall the whole linux partition.
Best Answer
Yes, your Ubuntu is broken
You messed up something important to package management.
So in practice, backup your important data (at least
/etc
and/home
), perhaps also the list of installed packages e.g. output ofdpkg -l
, and reinstall Ubuntu.(a non-novice could try to manage - like in other answers -, but then he would not have done such a huge and basic mistake)
That is probably what would consume less of your time. Keeping your current system with the help of other answers is keeping it in a very messy state (which would give you future headaches).
Since you are reformatting your disk, consider putting
/home
in a separate partition (so future such mistakes won't lose your data). Before doing that print on paper the output ofdf -h
anddf -hi
andfdisk -l
(they give information about disk space -both used and available- ...). Be wise to have a large enough system partition (the root file system); if you can afford it 100 Gbytes is more than enough.(terminology: Unix have directories, not "folders").
That (moving to
/usr/bin/
) is very wrong. Either improve your $PATH (preferably) or at most add symlinks in/usr/bin/
and preferably move (or add symlinks) executables to/usr/local/bin/
.The wise approach is to never change
/usr/bin/
,/bin
,/sbin
,/usr/sbin/
outside of package management tools (e.g.dpkg
,apt-get
,aptitude
, etc...). Read the FHS.