Accidentally moved directories and files under root and reboot the machine

I've accidentally run this command

sudo mv /* /applications/minced/

instead of

sudo mv ./* /applications/minced/

Unfortunately, I rebooted the machine And now I am getting this error

view the error

please help me


Solution 1:

Use a live session, mount the partition and do

sudo mv /media/{id}/applications/minced/* /media/{id}/ 

where {id} is your mountpoint. The files should not have changed owner or group or permissions so that should be relatively safe.

EXAMPLE from comments (so this only works for this occasion; others reading this: change the id and the source dir):

cd /media/ubuntu/5b1d3376-8683-4eb8-9a11-fe346ad3d76e
sudo mv applications/minced/* .

General advice: making a mistake is OK, making a mistake while fixing a mistake is a capital offense. Check what you do 2, 3, 4 times and , if possible, make a log of anything you do so you can backtrack what you did.

===

Otherwise do a reinstall without formatting your disks (only set the filesystems for all partitions related to this install to what it already is (likely ext4) and do NOT pick "format"). If possible make a backup from the live session.

After the system is up you need to clean out /applications/minced/ as it will hold files that used to belong to /.

===

And next time do NOT use sudo for a mv that does not need it. Those files are yours are they not? If so you do not need it. If you did please add yourself to the GROUP that owns the file so you do not need it.