Revert moving root directory recursively

You haven't moved the root directory (you can't), you've just moved nearly everything in it to the parent directory of whatever path you were on.

To complicate things, you've also moved mv so that won't work as expected. The following should work (as long as you haven't rebooted since asking this!) if you're still in the same directory you were when you fired your last mv off.

../bin/mv ../{bin,boot,etc,home,media,mnt,opt,root,sbin,selinux,usr,var,vmlinuz*} /

If you don't have any of those, just omit them from the command.

And if you don't have access (you won't be able to do a fresh login while things are in this state) you'll have to mount the filesystem externally (through something like LiveCD and mount the filesystem and then move the files into the right place. Braiam's answer should help with this part.


If you already rebooted or got logged out, you can boot in a liveCD/USB to fix your system. I'm going to omit the part where you know how to create a Live system and boot with Ubuntu (the alternative cd also works, just drop into a root shell):

First you should mount your system to somewhere, so:

mkdir /mnt/system
mount /dev/sda1 /mnt/system

I'm assuming /dev/sda1 is your root. If you have separated /bin or /usr you should mount them too:

mount /dev/sda2 /mnt/system/usr

Now, you should arrive to the directory you were before the catastrophe:

cd /mnt/system/tmp/UPS/up/upsilon

Now with the command that Oli gave, which I will copy with blatancy:

mv ../{bin,boot,etc,home,media,mnt,opt,root,sbin,selinux,usr,var,vmlinuz*} /mnt/system/

Now verify everything is in order:

# ls /mnt/system/
bin boot etc home media mnt opt root sbin selinux usr var etc...

Reboot your system and be more cautious in the future.