0

This question already has an answer here:

Have an odd occurrence (or at least I think? still pretty green in linux) where I tried running the mv to move a .png file to my Pictures directory, I copied the command directly from the terminal from when I ran the mv command:

$ sudo mv Firefox_wallpaper.png /Pictures

I would assume the file gets essentially cut and pasted into the Pictures directory.

File original location: /home/ebeeze
What I would assume after the MV command: /home/ebeeze/Pictures

Any help would be nice, not sure if I have permission to see it (ran sudo ls -a but nothing).

marked as duplicate by muru bash Dec 19 '17 at 10:54

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.

3

you put a "/" before picture. this makes it an absolute path

Your picture is now /Pictures in the root of the drive.

The command you wanted was:

 mv Firefox_wallpaper.png Pictures/

Note: sudo is normally not needed, unless writing to root owned folders or files. For most everyday tasks, it should not be used since root privileges poses a security risk.

  • mv Firefox_wallpaper.png Pictures also works, mv is wise enough not to overwrite the directory but to write into it. – dessert Dec 19 '17 at 10:56
  • God bless you ravery, really appreciate such a quick response, cheers!! – Ebeeze Dec 19 '17 at 11:04
  • @dessert -- adding "/" to designate a directory will prevent mv from renaming the file if you mistype the directory name. Am I correct in this assumption. – ravery Dec 19 '17 at 12:09
  • @ravery Yes, and generally it's the way to do – I just wanted to add that OP didn't do it wrong in this particular account. By the way, to be sure one would just type Pic, press <Tab> and let bash care for the correct spelling and the slash. :) – dessert Dec 19 '17 at 12:24

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