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 |
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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
10-13-2011, 04:48 AM
|
#1
|
|
Member
Registered: Apr 2008
Location: HYD, INDIA.
Posts: 113
Rep:
|
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.
ThanQ,
Nagendra
|
|
|
|
10-13-2011, 04:52 AM
|
#2
|
|
Guru
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 6,310
|
How is this a directory to be searched? It looks more like the name of a globbed file.
|
|
|
|
10-13-2011, 02:47 PM
|
#4
|
|
Moderator
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,903
|
What grail said: unless you're trying to search a bunch of
directories that have a '.log' extension this isn't going to work.
Cheers,
Tink
Last edited by Tinkster; 10-13-2011 at 02:48 PM.
|
|
|
|
10-13-2011, 10:12 PM
|
#5
|
|
Member
Registered: Mar 2010
Distribution: Debian
Posts: 201
Rep:
|
Code:
find /home/xyz/test -name \*.log
|
|
|
|
10-13-2011, 10:48 PM
|
#6
|
|
Moderator
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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 |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:31 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|