HELP!!!! I moved my entire root directory somewhere else!!!!
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
HELP!!!! I moved my entire root directory somewhere else!!!!
I am new to linux, and have only been using it for a month now. Today I issued the following command: mv /* /var/www because I was trying to move all the files in the folder to the web root. I know now that I was supposed to add a period before /* to make it ./*.
UGH! Is there any way to revert this? I can't even use simple commands like ls because it gives me the following error: bash: /bin/ls: No such file or directory
I'm hoping I can at least recover my files! I absolutely HATE myself at this very moment. Any help would be greatly appreciated!!!
I am new to linux, and have only been using it for a month now. Today I issued the following command: mv /* /var/www because I was trying to move all the files in the folder to the web root. I know now that I was supposed to add a period before /* to make it ./*.
UGH! Is there any way to revert this? I can't even use simple commands like ls because it gives me the following error: bash: /bin/ls: No such file or directory
I'm hoping I can at least recover my files! I absolutely HATE myself at this very moment. Any help would be greatly appreciated!!!
you can mv back them. usually root dir has this folders; /bin /sbin /usr /var /media /mnt /tmp /dev /lib (/lib64) /home /opt /root /boot /etc /lost+found /proc /sys
if you can rum mv (understandable), boot with install disk
i guess the very files you need will now be located in /var/www/home/%YOUR_USERNAME%, first recover them, then try to get back all other stuff. first things first anyway, begin with important data.
mv should be in /var/www/bin/mv now.
Replace ls with whichever command you need to use (e.g. cp). Arguments follow the command as normal. If you can run those commands OK, then you can start copying files back to where they ought to be. Make sure you preserve permissions when you copy the files over.
i guess the very files you need will now be located in /var/www/home/%YOUR_USERNAME%, first recover them, then try to get back all other stuff. first things first anyway, begin with important data.
mv should be in /var/www/bin/mv now.
OK, so when i try to access mv it says 'bash: bin/mv: No such file or directory'.
I went to /var/www and then tried to issue the command 'bin/mv * /*' to no avail.
Any thoughts on why that may be the case?
Also. is there a way to back up my files? I can't use the mv command anywhere it seems!
Thanks in advance...really appreciate the comments.
If you can't get to any of the commands you need you might try:
Boot from a Live CD, then mount the partition containing the moved items (if the live CD doesn't auto mount it for you). Then you can move the files from there without a problem.
This of course presumes that you have (or can make) a Live CD.
First, I am not sure what happens when you try to move everything in / to a folder that is inside of /---I would have thought that it would have given an error message.
I would recommend NOT attempting to sort things while operating within that same system. There are a minimum of two choices:
1. Run from a Linux Live CD
2. Put the hard drive in another computer and access it from there.
In either case, just try to recover your data---then simply re-install the OS.
If your data is really valuable, then clone the disk before doing anything else.
1) get a bootable live cd/dvd (knoppix for example)
2) boot from cd/dvd
3) make a directory where you will mount your hard drive (file system), ie mkdir /mnt/myfiles
4) mount the drive, mount -t auto /dev/sda1 /mnt/myfiles {where sda1 is your partition, you can look this up with fdisk -l, if you are using more partitions, then mount them accordingly... look at /etc/fstab once you get it accessible}
5) now go there, cd /mnt/myfiles/var and use mv to move folders back. see what ozanbaba said.
OR take the hard drive and plug it in another computer/usb/... might get you somewhere.
You might heed the suggestion to clone your disk before you start.
As an alternative to cloning, you could use a live-cd to copy your important content files to another storage device. If nothing goes well, you can always begin with a new installation, a bother but not a catastrophe, and copy your files back to /home.
I noted that you did not mention that back-up copy of your system, the one that we all should always make, but don't.
PS Do not hate your self. We all make mistakes :-) just be persistent.
and extra careful when running as root. use sudo as much as possible and
when in root shell (with su or directing logining as root), think twise before running a command.
i did very stupid things over the years (like not install a kernel, installing libX and friends but not the X itself or rm -rf important files.)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.