Prateek Narendra
Prateek Narendra

Reputation: 1937

How to find files with a name recursively and bring the whole path?

I want to find the files and directories containing the name "fink" (Part of file name is "fink". Not contents) and print their whole path from Root.

Whats the command for it in Linux?

Upvotes: 0

Views: 43

Answers (2)

mauro
mauro

Reputation: 5950

If you want to find only (regular) files OR directories containing "fink" in their names and print their path from root:

find / \( -type f -or -type d \) -name \*fink\* -print

and to list them:

find / \( -type f -or -type d \) -name \*fink\* -ls

in both cases you might want to add 2>/dev/null at the end to get rid of the errors (especially permission denied from /proc).

Upvotes: 1

Umamahesh P
Umamahesh P

Reputation: 1244

To find:

find . -name "*fink*" -print

To find and list:

find . -name "*fink*" |xargs ls -l

To find and print full path

find / -name "*fink*" -print

Upvotes: 1

Related Questions