LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Meaning of .files and when to use ./filename (https://www.linuxquestions.org/questions/linux-newbie-8/meaning-of-files-and-when-to-use-filename-105884/)

costasm 10-19-2003 08:54 AM

Meaning of .files and when to use ./filename
 
This may have been asked before but I dont even know how to search the forum for this question

Its really two questions.

1) What does it mean when a filename (or directory name?) is starts with a . (dot). Are these supposed to be hidden files?
E.g. .myFile will not be shown by "ls" but only "ls -a"

2) Why do I see many times references to filenames in commands preceded by the ./ instead of just the filename in the current directory E.g:

#cat ./someFile instead of #cat someFile

I am guessing so its to force to use the file from the current directory to avoide searching environment paths.
P.S. I know the meaning of . and ..

If there is a link somewhere where these things are discussed I would appreciated.

david_ross 10-19-2003 09:05 AM

1) Yes it is used to hide files - like the hidden file attreibute in windows.
2) With cat there should be no need to use "./" This should really only be used for running executeables in hte current directory. When you cat a file it won;t look in your path.

costasm 10-19-2003 09:19 AM

Quote:

Originally posted by david_ross
1) Yes it is used to hide files - like the hidden file attreibute in windows.

I find it weird that such a convention exists. I would think that a hidden file would be an attribute of the file properties and not of the filename itself. It sounds weird to have to change the filename if you want to unhide it. What if your app is referring to .filename and then someone renames it?

2) With cat there should be no need to use "./" This should really only be used for running executeables in hte current directory. When you cat a file it won;t look in your path.

Ok, why wouldn't the shell search the current directory first for the executable?

Is there some tutorial I can read on this stuff? WHat would I search under.

david_ross 10-19-2003 09:23 AM

The bash will only search the directoies in the path variable - to see your paths:
echo $PATH|sed s/\:/\\n/g

The bash howto probably has most of this in it:
http://www.tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html


All times are GMT -5. The time now is 06:43 AM.