Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Possible Duplicate:
Moved bin and other folders! How to get them back?

Hi I'm in desperate need of help. I'm quite new to linux so please bear with my stupidity! I entered the following command, which I know is not correct and I think I've moved everything to "../", can I do anything to recover from this:

mv /* ../
share|improve this question

marked as duplicate by Gilles, Ulrich Dangel, Michael Mrozek Aug 4 '12 at 4:31

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
This will surely make you consider backups. I suggest Areca :) –  Tim Aug 3 '12 at 20:55

2 Answers 2

If you had busybox already installed, you may have some success with:

../bin/busybox mv ../* /

after that, you can then manually clean up the stuff that should have been in ../ (wherever that is) back from / to wherever it belongs.

busybox has a chance of working where mv doesn't because busybox is linked statically and does not need to dynamically link any libraries.

If busybox wasn't already installed, you could try to boot a rescue CD, mount your hard disk partitions under /mnt, and mv stuff to where it belongs.

share|improve this answer

Yes, you screwed up. :) Everyone does it at some point. As you said, you've moved everything to ../ (if you were root).

Without knowing what directory you were in at the time, you might have a chance of getting things back to some reasonable state by typing ../bin/mv ../* / from the same directory.

Otherwise, you can boot from a recovery CD so you can back up your data, and then reinstall Linux.

While booting from the recovery CD, you could also try moving the root files and directories back to /. That way you might be able to avoid reinstalling.

Good luck!

share|improve this answer
    
Thanks for your help, looks like im going to have to go the recovery route! –  Vince Ashby-Smith Aug 3 '12 at 17:41
2  
@shellter /bin/mv was moved to a new directory so it is no longer in /bin/. Besides using the new location you typically also have to create LD_LIBRARY_PATH containing your new lib directories. –  Ulrich Dangel Aug 3 '12 at 17:49
    
doah! I remove my hare-brained comment. (I didn't know it was possible to move stuff above/beyond '/'. ) Good luck to all. –  shellter Aug 3 '12 at 20:21
    
@UlrichDangel Not just that, you also need to invoke the dynamic linker explicitly. See the duplicate question. –  Gilles Aug 3 '12 at 22:47
    
@VinceAshby-Smith This is in fact fairly simple to fix once you know what commands to run as long as you still have a root shell open. –  Gilles Aug 3 '12 at 22:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.