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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
12-04-2009, 04:08 AM
|
#1
|
LQ Newbie
Registered: Dec 2009
Posts: 2
Rep:
|
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!!!
|
|
|
12-04-2009, 04:35 AM
|
#2
|
Member
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778
Rep:
|
Quote:
Originally Posted by a_cheung
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
|
|
|
12-04-2009, 04:39 AM
|
#3
|
Member
Registered: Sep 2009
Location: Russia
Distribution: Gentoo, LFS
Posts: 399
Rep:
|
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.
|
|
|
12-04-2009, 04:57 AM
|
#4
|
Senior Member
Registered: Oct 2005
Location: UK
Distribution: Slackware
Posts: 1,847
Rep:
|
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.
|
12-04-2009, 05:31 AM
|
#5
|
LQ Newbie
Registered: Dec 2009
Posts: 2
Original Poster
Rep:
|
Quote:
Originally Posted by Web31337
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.
|
|
|
12-04-2009, 06:14 AM
|
#6
|
Member
Registered: Sep 2009
Location: Indiana, USA
Distribution: SLES, SLED, OpenSuse, CentOS, ubuntu 10.10, OpenBSD, FreeBSD
Posts: 195
Rep:
|
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
|
|
|
12-04-2009, 06:15 AM
|
#7
|
LQ Veteran
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809
|
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.
|
12-04-2009, 07:16 AM
|
#8
|
Member
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Rep:
|
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.
|
|
|
12-04-2009, 07:40 AM
|
#9
|
Senior Member
Registered: Jun 2008
Posts: 1,820
|
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.
|
|
|
12-04-2009, 08:08 AM
|
#10
|
Member
Registered: Sep 2005
Location: Split, Croatia
Distribution: Gentoo/Debian
Posts: 140
Rep:
|
PS Do not hate your self. We all make mistakes :-) just be persistent.
|
|
|
12-04-2009, 09:22 AM
|
#11
|
Member
Registered: May 2003
Location: İzmir
Distribution: Slackware64 15.0 Multilib
Posts: 778
Rep:
|
Quote:
Originally Posted by divukman
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.)
|
|
|
12-06-2009, 06:52 PM
|
#12
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,393
|
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.
|
|
|
All times are GMT -5. The time now is 12:59 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|