Unix/Linux Go Back    


UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

Linux find help

UNIX for Advanced & Expert Users


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago   -   Original Discussion by cokedude
cokedude's Unix or Linux Image
cokedude cokedude is offline
Registered User
 
Join Date: Feb 2010
Last Activity: 17 May 2018, 8:19 PM EDT
Posts: 442
Thanks: 32
Thanked 11 Times in 11 Posts
Linux find help

I am trying to find "php.ini". So I do the command:



Code:
find / "php.ini" 2>/dev/null


It is giving me thousands of files that do not contain "php.ini". What am I doing wrong?
Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago   -   Original Discussion by cokedude
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 28 May 2018, 3:27 AM EDT
Location: San Jose, CA, USA
Posts: 11,313
Thanks: 639
Thanked 3,938 Times in 3,368 Posts
Your requirements are not clear. The command that you are using is asking for the find utility to look at the root directory, every file in the file hierarchy rooted in the root directory, a file or directory named "php.ini" (and, if "php.ini" is a file of type directory, every file in the file hierarchy rooted in "php.ini") and to print the name of every file it encounters while looking at those files and file hierarchies.

Are you looking for a file named "php.ini"?

Are you looking for a file with a filename that contains the string "php.ini"?

Are you looking for a file with a filename that ends with the string "php.ini"?

Are you looking for a regular file that contains the string "php.ini" somewhere in its contents?
Sponsored Links
    #3  
Old Unix and Linux 1 Week Ago   -   Original Discussion by cokedude
RudiC's Unix or Linux Image
RudiC RudiC is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 28 May 2018, 3:43 AM EDT
Location: Aachen, Germany
Posts: 12,756
Thanks: 417
Thanked 3,923 Times in 3,607 Posts
Fully seconding what Don Cragun says, but wildly guessing you are looking for a file, why don't you try again adding the -name test?
    #4  
Old Unix and Linux 6 Days Ago   -   Original Discussion by cokedude
rbatte1's Unix or Linux Image
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 24 May 2018, 12:44 PM EDT
Location: Lancashire, UK
Posts: 3,535
Thanks: 1,558
Thanked 692 Times in 622 Posts
What you have asked the find command to do is to list everything under the root directory and everything under the directory php.ini (if that exists)

I suspect that this is not what you want and Don has already given suggestions of what you might want.

To get find to do something else, you will need to do something else. You don't say quite what you want so it's difficult to help. It could be:-
  • Find a file named php.ini
  • Find a file name containing php.ini
  • Find a file containing php.ini
  • Find a file only containing php.ini
  • Find a directory called php.ini
  • Find all files newer than a file called php.ini
  • Find all files of the same size as php.ini
  • Find all pipe files under a directory called php.ini
... to name but a few.


If you are still stuck, let us know what you actually need and we can try to help.


Kind regards,
Robin
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to Find out if an HP/Linux uses SAN or not? mrn6430 Linux 4 04-05-2013 04:14 PM
How to find Linux os series? vinayd Red Hat 3 03-08-2013 11:20 AM
help in find command in linux kidwai Linux 2 09-05-2011 03:25 PM
Find in HP,AIX vs Linux bParks UNIX for Advanced & Expert Users 6 06-22-2008 06:02 PM
How to find the help in Linux zp523444 UNIX for Dummies Questions & Answers 3 12-13-2005 06:02 PM



All times are GMT -4. The time now is 04:24 AM.