Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've a done wrong use of sudo mv command. Example:

sudo Mv/home/USER/Downloads/piff.pdf /root/PDFs

Then the directory /root/PDFs has been changed to a plain text file.

I can undo the command? I can retrieve the directory?

share|improve this question
The command you typed is invalid so the answer you get from me has assuptions. Please clarify what you mean. – Rinzwind Feb 10 '13 at 7:21

If the problem is that you forgot to add a / at the end then ...

sudo mv /root/PDFs /home/USER/Downloads/piff.pdf

will restore the file to its original location and then you can redo the move with...

sudo mv /home/USER/Downloads/piff.pdf /root/PDFs/.

Warning: this ONLY works on the assumption that you intended to move the file to directory /root/PDFs and forgot to add the /. I do also want to make a comment that if that is the case the actual mv you tried should have given an error (since the wrong move you made only works when the directory does not exist).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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