Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
What is the output of ls -al when you run it from ~/Downloads? You'll see the error you're seeing if there isn't a file of the exact same name present to be copied. –  user25656 Feb 22 '13 at 18:20
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
2  
Actually I got a typo in the terminal, anyway thanks for your answer. –  Herks Feb 22 '13 at 13:38
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

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.