LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-04-2007, 04:10 PM   #1
czy11421
LQ Newbie
 
Registered: Apr 2004
Posts: 28

Rep: Reputation: 15
find command


I use 'find' to search some string,

my command is
Code:
find  /root -name "*" -size -50k  | xargs grep -H -n -w "8088"
but I got something like

grep: /root/Azureus: No such file or directory

how to avoid this ?

Thanks.
 
Old 07-04-2007, 04:32 PM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Presumably, you mean "find /", to start searching from / (the root of the filesystem tree), rather than /root, which is a directory in / (and the root user's home directory).
 
Old 07-04-2007, 08:05 PM   #3
czy11421
LQ Newbie
 
Registered: Apr 2004
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Nylex
Presumably, you mean "find /", to start searching from / (the root of the filesystem tree), rather than /root, which is a directory in / (and the root user's home directory).
No, I know that directory is NOT existed in anywhere. I just want to skip this error message when finding & grep.

Thanks.
 
Old 07-04-2007, 08:17 PM   #4
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,467

Rep: Reputation: Disabled
But /root does exist
 
Old 07-04-2007, 08:33 PM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Are you using the root account as a normal account?

I'll bet that Azereus is a directory. Read through the info manual for find. There are other options you can use:

find /root -type f -size -50k | xargs grep -H -n -w "8088"

The -name "*" doesn't do anything useful.
 
Old 07-04-2007, 08:40 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
regardless of whether you intended to search "/" or "/root", do the first half of the command first--to be sure that you know what it is doing.

If you just want to suppress error messages, then add this to the end of the command: 2>/dev/null
 
Old 07-04-2007, 08:46 PM   #7
czy11421
LQ Newbie
 
Registered: Apr 2004
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by jschiwal
Are you using the root account as a normal account?

I'll bet that Azereus is a directory. Read through the info manual for find. There are other options you can use:

find /root -type f -size -50k | xargs grep -H -n -w "8088"

The -name "*" doesn't do anything useful.
Only /root/azerues (low-case) existed. If it is existed, why it outputs "no such file or directory" ?

Thanks.
 
Old 07-04-2007, 08:50 PM   #8
czy11421
LQ Newbie
 
Registered: Apr 2004
Posts: 28

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by pixellany
regardless of whether you intended to search "/" or "/root", do the first half of the command first--to be sure that you know what it is doing.

If you just want to suppress error messages, then add this to the end of the command: 2>/dev/null
This is what I am looking for. Thanks.

BTW, do we have any way to skip binary file, not search binary files ?

Thanks.
 
Old 07-04-2007, 09:17 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by czy11421
This is what I am looking for. Thanks.

BTW, do we have any way to skip binary file, not search binary files ?

Thanks.
somehow, use the "file" command (returns the type of a file)
 
  


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
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 05:30 PM
Best Find Command ckoniecny Linux - General 16 02-15-2006 11:34 AM
The find command Gins Linux - General 32 06-12-2005 02:20 PM
find command slack66 Slackware 8 03-14-2005 03:17 PM
help with the find command clockworks Linux - Software 2 02-17-2004 04:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:48 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
Open Source Consulting | Domain Registration