LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 12-25-2010, 02:37 AM   #1
syed habeebuddin
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Rep: Reputation: 0
Unhappy Please help me on find command


Greetings

Can any one help me on find command.

when loggin as a normal user and search for a file passwd under /etc. i get few errors with permission denied.

how to ignore this permission denied errors.

csh hostname 109 % find . -name passwd
find: ./lvm/backup: Permission denied
find: ./lvm/archive: Permission denied
find: ./lvm/cache: Permission denied
find: ./pki/CA: Permission denied
find: ./racoon/certs: Permission denied
find: ./audit: Permission denied
find: ./cups/ssl: Permission denied
./pam.d/passwd
./uucp/passwd
find: ./selinux/targeted/modules/active: Permission denied
find: ./selinux/targeted/modules/previous: Permission denied
find: ./selinux/mls/modules/active: Permission denied
find: ./selinux/mls/modules/previous: Permission denied
find: ./selinux/strict/modules/active: Permission denied
find: ./selinux/strict/modules/previous: Permission denied
./passwd
find: ./rhgb/temp: Permission denied
find: ./audisp: Permission denied
find: ./ipsec.d: Permission denied
find: ./quagga: Permission denied
find: ./cron.d: Permission denied
find: ./Pegasus: Permission denied
 
Old 12-25-2010, 02:40 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Some directories are accessible only by root. If you run find under /etc as normal user, you will get these messages. However, they are redirected to standard error, whereas the actual results of the find command are directed to standard output. You can filter out the standard error, by redirecting it to /dev/null (the black hole of unix systems):
Code:
find /etc -name passwd 2> /dev/null
Hope this helps.
 
Old 12-25-2010, 02:45 AM   #3
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,528

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
You can issue the command as root, or use
Code:
slocate
Before you use locate, you need to run
Code:
updatedb
as root.
Locate will look in the database created by updatedb.
Some distro's have a cronjob to run updatedb every day.
See
Code:
man slocate
and
Code:
man updatedb
Kind regards
 
Old 12-25-2010, 03:07 AM   #4
syed habeebuddin
LQ Newbie
 
Registered: Nov 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thank you very much...

How to exclude the DOT files.
 
Old 12-25-2010, 03:20 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Quote:
Originally Posted by syed habeebuddin View Post
How to exclude the DOT files.
Code:
find . -not -regex '.*/\..*'
 
  


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
[SOLVED] Find a file in directories without using find command sikanders Linux - Newbie 14 08-06-2010 08:47 PM
Find/grep/wc command to find matching files, print filename and word count dbasch Linux - Newbie 10 09-14-2009 05:55 PM
Single find command to find multiple files? thok Linux - Newbie 7 01-31-2009 04:45 PM
Using a single "Find" Command to find files bases on multiple criteria roboxooo Linux - Newbie 6 01-15-2009 04:13 AM
can't find my find command! how to replace? dave247 Debian 4 11-19-2008 10:51 AM


All times are GMT -5. The time now is 04:47 PM.

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