1

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).

dessert
  • 39,982
Ebeeze
  • 13

1 Answers1

4

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.

ravery
  • 6,874
  • 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
  • 1
    @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 and let bash care for the correct spelling and the slash. :) – dessert Dec 19 '17 at 12:24