grep does not care about file names beginning with period.
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I assume that OP means that grep abc * does not return results in files starting with a dot although one might expect that. If so, read on
That's not grep, but the shell. The shell interpretes the command that you have typed and will say:
hey, grep is the command, let's try to find it
hey, abc is an argument, just pass it
hey, * is a wildcard so I will try to expand it
When you pass the wildcard, the shell will expand it and pass all matching files. However, the shell does not include files starting with a dot.
You can test it by running echo * which will display a list of all files in a directory (except the dot files ).
I have experienced the same. I think the reason for this is that bash treats "." period as the "current directory". So each time I use grep against a .file (hidden) I have to define its directory first. This manner: for example, against the file ~/.dmrc we do: