The / folder accidently moved

Version française

The other day, by installing this blog, I succeed to put my server in a mess. Indeed, I succeed to move all folders of / into an other folder. The result was I was in the impossibility to run base shell commands like mv, cp…

What was happened ?

To install my Wordpress engine, I downloaded the Wordpress archive from the official website with the wget command into the /tmp folder of my server. Following this, I uncompressed the archive with a little unzip that created a wordpress-4-4-1 directory with the files needed by Wordpress.

The remaining thing was to move the content of this folder into the /var/www/blog of my personal server. And it was here that the issue happened. Indeed, I ran the command line (be careful to the whitespaces in this command !) :

mv /tmp/wordpress-4-4-1 / /var/www/blog

The mv command line is designed to move all folders passed in arguments into the folder defined by the latest argument. The result was I well had the folder /tmp/wordpress-4-4-1 and its content into /var/www/blog, but, I also had all folders and files (except for someones) of / into /var/www/blog.


I saw my error as soon as I wanted to do a ls (see below error) to check the content of my folder and I wanted to go back by moving back the files and folders from /var/www/blog into /.

But it was impossible to do that because the only answer my server send me when I ran the mv command was:

No such file or directory

Of course, a little number of base commands were still working (it remained me cd and it was almost all).

I also tried to run the mv command with its absolute (new) path:


, but without success.

If you are in my case and you didn't restart your computer/server or you are still connected to our session, DON'T DO THAT and follow the below explanations.


By moving the / folders into an other folder, the usage of the shared libraries system has been affected and it didn't find the links. Indeed, the dynamic linker /lib/x86_64-linux-gnu/ of my Ubuntu 64 bits (the name of the dynamic loader can be a bit different in other architectures) was not anymore reachable in /lib, hence the command didn't work well.


As the dynamic linker is not reachable, you have to indicate explicitly to commands where it is. To put the things in the good place, you have to put the dynamic loader and all the stuff that were in /lib and /bin before the issue in the good place. This was done with the following command: /var/www/blog/lib/x86_64-linux-gnu/ –library-path /var/www/blog/lib/x86_64-linux-gnu /var/www/blog/bin/mv /var/www/blog/bin /var/www/blog/lib /

Then, you have to run the mv command to put the things to the good place (in /):

/lib/x86_64-linux-gnu/ --library-path /lib/x86_64-linux-gnu /bin/mv /var/www/blog/* /

Voilà all's well that ends well. However, I believed that I had to re-install a complete installation of my server with restore of backups. This also told me that my backups strategy was not very good because my backups were old.

I hope this help some people. If you comments and/or questions, don't hesitate to comment.