Lv2eof
Lv2eof

Reputation: 1949

Linux "find" returns all files

A few days ago I was reading about the Linux find tool and based on that I issued the following command to see if I have the Python.h file:

find . 'Python.h'

The problem is that all files in current dir and subdirs are returned. Shouldn't I get what I'm looking for?

Upvotes: 1

Views: 887

Answers (2)

Zbynek Vyskovsky - kvr000
Zbynek Vyskovsky - kvr000

Reputation: 18865

Use -name switch:

find . -name  'Python.h' 

Otherwise it takes the name as location to look at.

Upvotes: 1

user1357959
user1357959

Reputation:

You left out the parameter specifier -name:

find ./ -name 'Python.h'

find will recurse through all directories in the current directory. If you just want to see whether you have a file in the current directory, use ls:

ls Python.h

Upvotes: 3

Related Questions