Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-13-2011, 04:48 AM   #1
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 146

Rep: Reputation: 15
find hidden files from wild card path using 'find'

I have normal and hidden files with ".log" extension (Ex: a.log, b.log, .aa.log, .bb.log, .cc.log) in /home/xyz/test directory.

I tried to find the whether .aa.log file exist or not that directory using 'find' command as follows.

$ find /home/xyz/test/*.log -name .aa.log

But i did not get nothing even though ".aa.log" file exists.

I need to find the whether .aa.log file exist or not that directory using 'find' command with wildcard searching directory(Ex: /home/xyz/test/*.log).

Please help me to get his.

Old 10-13-2011, 04:52 AM   #2
LQ Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 8,111

Rep: Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185Reputation: 2185
How is this a directory to be searched? It looks more like the name of a globbed file.
Old 10-13-2011, 02:35 PM   #3
Registered: Sep 2008
Location: RJ-Brazil
Distribution: Slackware
Posts: 175

Rep: Reputation: 5
Can you use another command such as ls -la, locate or grep?

Look at this thread
Old 10-13-2011, 02:47 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,041
Blog Entries: 11

Rep: Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907Reputation: 907
What grail said: unless you're trying to search a bunch of
directories that have a '.log' extension this isn't going to work.


Last edited by Tinkster; 10-13-2011 at 02:48 PM.
Old 10-13-2011, 10:12 PM   #5
Registered: Mar 2010
Distribution: Arch
Posts: 209

Rep: Reputation: 66
find /home/xyz/test -name \*.log
Old 10-13-2011, 10:48 PM   #6
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657Reputation: 657
I use ".[^]*" to list hidden files and directories, to eliminate the pattern ".." when looking for hidden file and directories.

"ls .[^.]*" to list files and directories. "ls -d .[^.]*/" to list just hidden directories.

When using the find command, put the name pattern inside quotes or double quotes so the find command reads the wild card.
Escaping the wild cards works, but always putting the file name pattern in quotes makes the pattern stand out.
Use the -maxdepth 1 option to prevent descending into subdirectories. Add -type f or -type d to show only files or directories respectively.


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
How do I make find exclude hidden files (.files) Rotwang Linux - General 2 08-08-2011 03:58 AM
Install libclamav with PHP *cannot find clamav files in default path* j.smith1981 Linux - Software 8 05-27-2011 05:32 AM
[SOLVED] Delete regular files (not hidden files) with find + rm in one line older than 15 Virtuose Linux - Newbie 1 01-08-2011 05:24 PM
[SOLVED] 'find' command regex to exclude hidden files? arashi256 Linux - Newbie 3 06-28-2010 08:53 AM
Find hidden executable files Wynd Linux - General 2 06-09-2003 03:09 AM

All times are GMT -5. The time now is 10:54 AM.

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