LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 12-04-2009, 05:08 AM   #1
a_cheung
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Rep: Reputation: 0
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!!!
 
Old 12-04-2009, 05:35 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
Quote:
Originally Posted by a_cheung View Post
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
 
Old 12-04-2009, 05:39 AM   #3
Web31337
Member
 
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Blog Entries: 71

Rep: Reputation: 65
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.
 
Old 12-04-2009, 05:57 AM   #4
pwc101
Senior Member
 
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847

Rep: Reputation: 128Reputation: 128
If you can't use and of the standard commands in the usual manner, try calling commands as follows:
Code:
/var/www/lib/ld-linux.so.2 --library-path /var/www/lib /var/www/bin/ls
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.
 
1 members found this post helpful.
Old 12-04-2009, 06:31 AM   #5
a_cheung
LQ Newbie
 
Registered: Dec 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Web31337 View Post
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.
 
Old 12-04-2009, 07:14 AM   #6
never say never
Member
 
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195

Rep: Reputation: 37
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.

Good Luck
 
Old 12-04-2009, 07:15 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
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 members found this post helpful.
Old 12-04-2009, 08:16 AM   #8
divukman
Member
 
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Blog Entries: 8

Rep: Reputation: 15
Arrow

a_cheung,

This could help:

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.

Last edited by divukman; 12-04-2009 at 08:22 AM.
 
Old 12-04-2009, 08:40 AM   #9
thorkelljarl
Senior Member
 
Registered: Jun 2008
Posts: 1,787

Rep: Reputation: 211Reputation: 211Reputation: 211
pixellany's wise words...

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.
 
Old 12-04-2009, 09:08 AM   #10
divukman
Member
 
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Blog Entries: 8

Rep: Reputation: 15
Talking

PS Do not hate your self. We all make mistakes :-) just be persistent.
 
Old 12-04-2009, 10:22 AM   #11
ozanbaba
Member
 
Registered: May 2003
Location: Tengiz
Distribution: Slackware64 14.1
Posts: 672

Rep: Reputation: 94
Quote:
Originally Posted by divukman View Post
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.)
 
Old 12-06-2009, 07:52 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Depending on your distro, you may be able to use the install media instead of getting a LiveCD. Just boot off it, then enter

linux rescue

at the cmd line & follow the same instructions above.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] mv /* ./ - bin and other folders moved to home directory Seregwethrin Linux - Server 4 06-30-2009 05:50 PM
Copying entire directory with subdirectory? centosfan Linux - Newbie 1 04-20-2007 10:14 PM
Linux root moved from hda2 to hda1 dangerousdave Linux - Software 3 11-02-2005 07:18 PM
remove entire directory. bruse Linux - Newbie 2 04-27-2005 02:23 AM
removing an entire directory pasalacqua128 Linux - Software 2 06-03-2004 05:37 PM


All times are GMT -5. The time now is 03:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration