LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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!

Notices


Reply
  Search this Thread
Old 07-10-2009, 07:18 PM   #1
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Rep: Reputation: 75
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.

Last edited by micxz; 07-10-2009 at 07:48 PM.
 
Old 07-10-2009, 07:54 PM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 648

Rep: Reputation: 249Reputation: 249Reputation: 249
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
 
Old 07-10-2009, 07:57 PM   #3
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
I knew it was something simple the print flag needed to be after I name the file. I feel like a fool. Thanks;
 
Old 07-10-2009, 08:02 PM   #4
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 648

Rep: Reputation: 249Reputation: 249Reputation: 249
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
files starting with .(period) kk1 Linux - General 2 04-28-2009 08:33 AM
Finding multiple files with ascending numerical files extensions unim21 Linux - Newbie 3 04-23-2009 07:50 PM
when finding files in Konqueror, why use the files index? newbiesforever Linux - General 4 03-20-2009 09:06 AM
Screen saver does not start after period of inactivity statguy Slackware 3 02-27-2009 07:52 PM
Finding files and then finding content within those files... Maeltor Linux - Software 5 03-13-2007 12:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:47 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration