18

I tried a command cp /vol/examples/tutorial/science.txt . and I get the error -

cp: cannot stat `/vol/examples/tutorial/science.txt': No such file or directory

I don't understand why this is happening. I went to cygwin home folder and created the necessary folder structure and text file. I also checked the folder structure and names.

Also, I go into ~/vol/examples/tutorial and then do cat science.txt and I can read the document. Then why does the CP command not work ?

0
12

Do this and you will understand:

cd ~/vol/examples/tutorial 
pwd

most likely the result of pwd is not just /vol/examples/tutorial but /home/username/vol/examples/tutorial

~ is replaced by the user home directory, usually and even under cygiwn /home.

2
  • yes, it is /home/username/vol/examples/tutorial. I did cat ~/vol/examples/tutorial/science.txt and I can see the text file. But, I don't understand why all these errors happened. I am reading this tutorial at - ee.surrey.ac.uk/Teaching/Unix/unix2.html – bashboy Jul 24 '13 at 19:27
  • 5
    because when you use cp /vol is not the same as cp ~/vol. change your cp command to cp ~/vol/ to work. It is not a problem, you are providing different paths – BitsOfNix Jul 24 '13 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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