when we specify the file path some times we specify like ./filename and some time ../filename what is difference between these two?

migrated from stackoverflow.com Aug 4 '10 at 12:30

This question came from our site for professional and enthusiast programmers.


../ refers to the parent folder while ./ means the current folder

  • they are just a shortcut, so you dont have to write out long directory names. – Keltari Aug 25 '11 at 2:41

. means 'the current folder'.
.. means 'the folder containing the current folder'.


just in case you wonder, ./filename actually means the same thing as filename - however, on unix systems, the current path isn't searched for executables (for security reasons), so you have to explicitly say "look in the current directory"


Both are different. ./filename points to a file in current directory while ../filename points to a file in parent directory

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.