LinuxQuestions.org
Help answer threads with 0 replies.
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, 04: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, 04:35 AM   #2
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
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, 04: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, 04: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, 05: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, 06: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, 06:15 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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, 07: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 07:22 AM.
 
Old 12-04-2009, 07:40 AM   #9
thorkelljarl
Senior Member
 
Registered: Jun 2008
Posts: 1,820

Rep: Reputation: 229Reputation: 229Reputation: 229
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, 08: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, 09:22 AM   #11
ozanbaba
Member
 
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778

Rep: Reputation: 135Reputation: 135
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, 06:52 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,393

Rep: Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774Reputation: 2774
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 04:50 PM
Copying entire directory with subdirectory? centosfan Linux - Newbie 1 04-20-2007 09:14 PM
Linux root moved from hda2 to hda1 dangerousdave Linux - Software 3 11-02-2005 06:18 PM
remove entire directory. bruse Linux - Newbie 2 04-27-2005 01:23 AM
removing an entire directory pasalacqua128 Linux - Software 2 06-03-2004 04:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:59 PM.

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
Open Source Consulting | Domain Registration