Well, I can't remember everything...

Friday, 9 August 2013

Searching for a file using Unix command line

This will search the current directory and all sub-directories for an exact match of string in quotes

find . -name "searchstring" -print
Here is an example with output

[root@cacti /]# find . -name "cacti" -print

You can add asterisks as a wild card. The example below finds any filename that contains the search string

[root@cacti /]# find . -name "*cacti*" -print

No comments:

Post a Comment