Finding a lost file

I issued a mv command and the file disappeared. The actual command was:

king@linux-jkzv:~/Desktop> sudo mv fwunixref.pdf /Documents

I should have specified /Documents better but it is too late now. Where did it go? Heres the ls of the file:

king@linux-jkzv:~/Documents> ls
Esperanto Textbook linux_manual.pdf New Document.ott New Spreadsheet.ots

Thanks for the help.

Why did you use **sudo **?It seems that you just wanted to move a file as a ‘normal’ user fom your Desktop directory to the Documents directory both in your home directory.

To find a file named fwunixref.pdf anywhere in the system

find / -name 'fwunixref.pdf'

Do this as root because you moved it as root, so it may now be somewhere where the normal user has no access.

When it is found as /Documents/fwunixref.pdf (my guess) move it (as root) to the right place and then remove /Documents because there normaly is no Documents in the root directory / .

THANK YOU! When I did the mv command I screwed it up as you could tell and I completely forgot that I would have done that as su. Thanks.

I appoligize. Did not read your post carefully enough. Your statement was

king@linux-jkzv:~/Desktop> sudo mv fwunixref.pdf /Documents

which did exactly as you asked: the file fwunix.pdf in directory /home/king/Desktop was moved and renamed and became file Documenst in directory / (the root). You found it nevertheless. Congratulations and do use root ONLY when needed

IBC drunk wrote:
> THANK YOU! When I did the mv command I screwed it up as you could tell
> and I completely forgot that I would have done that as su. Thanks.

NO! you should not have done it as su…because that is ALSO
root…and would have also resulted in moving the file to
/root/Desktop [hmmmmm…actually, i just looked my /root does NOT
have a /Desktop, and neither should your!! only way it gets one is if
you actually sign into either KDE, Gnome (or other GUI) as
root…something you should NEVER NEVER EVER do: see
http://tinyurl.com/6ry6yd]

all you had to do (if in /Desktop, as you were) was:


mv fwunixref.pdf /Documents

a good practice (imo) is to remove the possibility of sending the
wrong file to the wrong place is to either use FULL addresses, like:


mv /home/king/fwunixref.pdf /home/king/Documents

OR use that expensive GUI you have: like, pop open an instance of
konqueror, find your /Documents folder, right click ‘grab’
fwunixref.pdf and ‘drag’ it over into Documents…and, let go
(release the mouse’s right button…then, in the menu that pops up
select ‘Move’…

personally, i just put a link to my Documents on my desktop, and it
is even easier!!


see caveat: http://tinyurl.com/6aagco
DenverD (Linux Counter 282315) via NNTP, Thunderbird 2.0.0.14, KDE
3.5.7, SUSE Linux 10.3, 2.6.22.18-0.2-default #1 SMP i686 athlon

For DenverD: You are of course right in your flame against using root (be it via su, sudo or Kmenu>System>FileManager> FileManger( inSystemManagersModee) or any other. But you, as I at my first glance, missed that he moved into /, not into **/root/Documents/ **and that the name was changed in Documents. And of course, when he had tried this as king and not has root, he wold have got an error because no permission to write into /.

For IBC_drunk. I again misunderstood you. I thought you mistyped or you simply typed some bad english. But DenverD opened my eyes!! both **su **and sudo (and every other method where you have to type the root password) make you *root. *WHICH YOU SHOULD NOT USE FOR SUCH A TRIVIAL THING WITHIN THE DOMAIN OF king!!!!

Apart from the link DenverD gave you I refer to SDB:Login as root - openSUSE

Again: use root only when needed and then with extreme care. >:)

hcvv wrote:
> But you, as I at my first glance,
> missed that he moved into /, not into */root/Documents/ *and that the
> name was changed in *Documents.

ah…you are correct, his command moved the file from King’s desktop
to a new file named “Documents” in /

cute…

and my previous example was similarly flawed, it should have been


mv fwunixref.pdf ~/Documents/*

or, did i miss it again?

his was/is a perfect example of why it is important to KNOW WHAT your
are doing, and THINK about what you want to do, and what your command
will do, every time you provoke the power of ROOT!!


DenverD (Linux Counter 282315) via NNTP, Thunderbird 2.0.0.14, KDE
3.5.7, SUSE Linux 10.3, 2.6.22.18-0.2-default #1 SMP i686 athlon

Exactly.
…(to fill to 10 characters lol! )

…and never ever do this:

#rm -rfv *

Or take of the v for a silent kill.

You’ll be fine until you hit the kernel.