LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Finding files that start with a period? (https://www.linuxquestions.org/questions/linux-newbie-8/finding-files-that-start-with-a-period-739289/)

micxz 07-10-2009 07:18 PM

Finding files that start with a period?
 
Seems like this should be easy but for some reason I'm having trouble finding only files that start with a period "." here's clip from my history.
Code:

1118  find /var/www/vhosts/ -type f -print -name "\.*"
 1119  find /var/www/vhosts/ -type f -print -iname ^.*
 1121  find /var/www/vhosts/ -type f -print -name .*
 1122  find /var/www/vhosts/ -type f -print -name .\*
 1123  find /var/www/vhosts/ -type f -print | grep .[^\.]*
 1125  find /var/www/vhosts/ -type f -print -name .[^\.]*
 1126  find /var/www/vhosts/ -type f -print -name [^\.]*
 1127  find /var/www/vhosts/[^\.]* -type f -print
 1128  find /var/www/vhosts/ -name [^\.]* -type f -print
 1129  find /var/www/vhosts/ -type f -print
 1131  find /var/www/vhosts/ -type f -print \( -regex ".*/\..*" \)
 1132  find /var/www/vhosts/ -type f -print -regex ".*/\..*"
 1133  find /var/www/vhosts/ -type f -print -regex "^.*/\..*"
 1134  find /var/www/vhosts/ -type f -print -regex "^.*"
 1135  find /var/www/vhosts/ -type f -regex "^.*"
 1137  find /var/www/vhosts/ -type f -print | egrep "^."
 1138  find /var/www/vhosts/ -type f -print | egrep "^\."
 1139  find /var/www/vhosts/ -type f -print | egrep "^\.*"
 1141  find /var/www/vhosts/ -type f -print | egrep ^\.
 1142  find /var/www/vhosts/ -type f -print | egrep ^.*
 1143  find /var/www/vhosts/ -type f -print | grep .*
 1145  find /var/www/vhosts/ -type f -print | grep \.*
 1146  find /var/www/vhosts/ -type f -print | grep .[^\.]*

There is probably a very very simple solution and I'm just not thinking right this evening. All of the above either have no output or print all files.

norobro 07-10-2009 07:54 PM

First tried:
Code:

find . -type f -name "\.*"
and that worked on my machine, so I moved the "-print" to last and that works also.
Code:

find . -type f -name "\.*" -print

micxz 07-10-2009 07:57 PM

I knew it was something simple the print flag needed to be after I name the file. I feel like a fool. Thanks;

norobro 07-10-2009 08:02 PM

You're welcome.

I took a look at the man page and I didn't see anything about where "-print" should be, but all of the examples have it last. With it before "-name" I got hidden directories and files. Go figure.

Norm


All times are GMT -5. The time now is 07:13 PM.