Ubuntu copying file problem (cannot stat file)

I've faced a problem when copying a file with the commands,

cp ~/Downloads/sample.pdf ~/Desktop/

But the terminal gives me a message, cp: cannot stat 'sample.pdf': No such file or directory.


Solution 1:

Have you verified that sample.pdf is the exact filename in the downloads folder? It looks like the path is incorrect and that file doesn't actually exist there. Try this...

ll ~/Downloads

See if sample.pdf shows up in the file list.

Solution 2:

If the file exists you have maybe not the correct permissions zu copy the file. Run in a terminal: sudo chmod 775 /home/<user>/Downloads/sample.pdf to grant yourself the permissions and sudo chown <your-user>:<your-user-group> /home/<user>/Downloads/sample.pdf to own the file and try to copy it again. Your user-group shoul be the same value as your user.