There are a couple of ways to do this with find.
find . -iname 'test*' -type f -exec ls -i {} \;
find : the find command
. : the directory to search
-iname 'test*' : search for anything that matches test* regardless of case
-type f : only look for files
-exec ls -i {} \; : execute ls -i on each file found
find . -iname 'test*' -type f -printf '%i %f\n'
find : the find command
. : the directory to search
-iname 'test*' : search for anything that matches test* regardless of case
-type f : only look for files
-printf '%i %f\n' - print the inode, then the file's name only (no directories), and separate each file by a newline
Notes:
- Substitute
-iname for -name if you want to be case sensitive.
- Substitute
. with the absolute path if you want to search anything other than the current working directory.
- Substitute
%f with %p for the file's name, including the path (differs whether you use relative or absolute paths in your find command).
- If you would like to be selective in your directories, don't forget the parameters
-prune and -depth
- You can be more specific with your string and do something like
'test[0-9]' to find everything test0-test9, or 'test[0-9]*' for anything with the string "test", then one digit, anything after that.