LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-14-2015, 10:48 AM   #1
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,162

Rep: Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205Reputation: 2205
Command-line "find" to include hidden files and directories?


Do you happen to know if the command-line find command will search, or can be made to search, hidden directories that it finds?
 
Old 10-14-2015, 11:24 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 2,959

Rep: Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268Reputation: 1268
Quote:
Originally Posted by sundialsvcs View Post
Do you happen to know if the command-line find command will search, or can be made to search, hidden directories that it finds?
The leading "." in a file or directory name is not special to the find command, so it will treat those names just like any other. Of course if you run something like "find * ...", then it's your shell that is expanding the "*", and find sees only the result of that, and shells typically do not, at least by default, include dotfiles in that expansion.
 
Old 10-14-2015, 11:29 AM   #3
HMW
Member
 
Registered: Aug 2013
Location: Sweden
Distribution: Debian, Arch, Xubuntu, Manjaro
Posts: 745
Blog Entries: 3

Rep: Reputation: 347Reputation: 347Reputation: 347Reputation: 347
Quote:
Originally Posted by sundialsvcs View Post
Do you happen to know if the command-line find command will search, or can be made to search, hidden directories that it finds?
Umm... why not do this:
Code:
find $HOME -type d -iname ".*" -exec grep -Ir 'foobar' {} \;
First use find to get the hidden directories, then use grep to recursively search through them. Or maybe I am missing something?

Best regards,
HMW
 
  


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
Where can I find the source code for the "swapon" command line tool? ehabababneh Linux - Software 5 08-17-2013 09:48 PM
Using a single "Find" Command to find files bases on multiple criteria roboxooo Linux - Newbie 6 01-15-2009 05:13 AM
Shell and batch operations on hidden files but not on ".." & "." danielsbrewer Linux - Software 5 09-12-2007 09:06 AM
rsync - How to Include Hidden (.something) Files and Directories? edwin11 Linux - Software 4 11-29-2006 08:47 AM


All times are GMT -5. The time now is 06:48 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