Home Man
Search
Today's Posts
Register

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

Tags
advanced

Login to Reply

 
Thread Tools Search this Thread
# 1  
Old 05-17-2018
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?
# 2  
Old 05-17-2018
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?
# 3  
Old 05-18-2018
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 05-21-2018
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
    # 5  
    Old 06-13-2018
    Quote:
    Originally Posted by Don Cragun
    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?
    This one:

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

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

    Is this how you would do these two?

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

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

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

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

    How would you do this one?

    Are you looking for a regular file that contains the string "php.ini" somewhere in its contents?

    Quote:
    Originally Posted by RudiC
    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?
    Yes this worked .

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

    Login to Reply

    « Previous Thread | Next Thread »
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes

    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
    Command to find 32/64 bit in Linux aish11 Shell Programming and Scripting 3 01-25-2012 07:41 AM
    help in find command in linux kidwai Linux 2 09-05-2011 03:25 PM
    How to Find what HBA is configured on Linux? Tirmazi Red Hat 4 04-06-2011 10:25 AM
    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
    Command to find 32/64 bit in Linux giribt UNIX for Dummies Questions & Answers 3 08-17-2005 09:19 PM


    All times are GMT -4. The time now is 03:13 AM.

    Unix & Linux Forums Content Copyrightę1993-2018. All Rights Reserved.
    UNIX.COM Login
    Username:
    Password:  
    Show Password