1

I accidently used mv mymods /* * . Now i am unable to undo it or either use any command. How do i fix that?

I was in directory name /home/nginx/crap

[root@somehost /home/nginx/crap]# mv mymods /* *

Centos 6.3 user - root

Directory Structure of /home/nginx/crap

https://gist.github.com/anonymous/5493666

slm
  • 369,824

2 Answers2

2

You most likely moved the files at /*, which is essentially everything, given / is the top level directory and you move everything, *, under it. I guess my question would be where did you move it to?

You might be able to move everything back if you can figure out where you moved it to. You'll have to call the mv command directly (ie. /accident/dir/mv) given it's now in some other location, and there is no guarantees you'll be able to even run it given that any libraries it might need aren't where they're suppose to be either.

I would suggest booting the system using the rescue CD capability that comes with the CentOS CD/DVD and allowing it to mount your HDD. From there you should be able to use the Live CD's mv command to repair your HDD's Linux installation.

slm
  • 369,824
  • I was in directory /home/nginx/crap , then i issued that command which messed up things. Any idea? – Thomas Coulson May 01 '13 at 03:34
  • Yeah so everything is most likely in that directory. I'd still use a rescue CD to effect repairs. – slm May 01 '13 at 03:35
  • That's a dedicated server hosted at OVH. I don't know, how to boot it via live cd. – Thomas Coulson May 01 '13 at 03:36
  • 1
    See if the mv command is under that path then would be your next option. It's going to be most like here: /home/nginx/crap/bin/mv. – slm May 01 '13 at 03:40
  • This might be helpful, it's OVH's tips for restoring deleted files: http://help.ovh.co.uk/BackupsOnPlanWeb – slm May 01 '13 at 03:52
0

That command would have resulted in:

  1. File or folder /home/nginx/crap/mymods
  2. All directories at / (in theory)
  3. All files and directories in /home/nginx/crap/

moved into last directory given by * in /home/nginx/crap/. As in:

ls -d /home/nginx/crap/*
afile1 afile2 dir1 dir2

Then everything would be put into dir2.

If the last entry of * was a file the command would have failed as you cannot move files and folders into a file.

As the last file in your gist post is tree.txt you most likely did not move any files – and something else has happened.

See if you have the env command available.

slm
  • 369,824
Runium
  • 28,811