Finding files

I am having trouble finding the options I need to find a file in an unknown directory.
The manual for find(1) is not helping me.

For example I want to find omxplayer. Using find omxplayer* it returns no files or directories. I know it is in usr/ports but this is an example.

I am searching from the top level of the file system and would like to search all subdirectories of the system and show matching files and directories.

What is the option I need? Is my wildcard valid?
I am currently using sysutils/catfish but would like to handle this from the command prompt.
 
Do you know the locate(1) command?

Actually it uses find(1) for populating the locate database. Creating/updating the database takes several minutes, but once the database is ready, global file system search is extremely fast.

For creating the database, issue the following command:
# /usr/libexec/locate.updatedb

I do this as root user and since I know, what I am doing, I do ignore the respective warning.

For locating something, you would issue:
locate omxplayer
Code:
/usr/ports/multimedia/omxplayer
/usr/ports/multimedia/omxplayer/distinfo
/usr/ports/multimedia/omxplayer/files
/usr/ports/multimedia/omxplayer/files/patch-Keyboard.cpp
/usr/ports/multimedia/omxplayer/files/patch-Keyboard.h
/usr/ports/multimedia/omxplayer/files/patch-linux_PlatformDefs.h
/usr/ports/multimedia/omxplayer/files/patch-Makefile
/usr/ports/multimedia/omxplayer/files/patch-Makefile.include
/usr/ports/multimedia/omxplayer/files/patch-omxplayer.cpp
/usr/ports/multimedia/omxplayer/Makefile
/usr/ports/multimedia/omxplayer/pkg-descr
 
Try this.
find / -type d -name 'omxplayer*'

/ - indicates wherefrom you start to look for of the directories tree
-type d - indicates you look up directories
-name - indicates you look for specific name

You can use -type f to find files.
Or just use find / -name 'omxplayer*' to find files and directories.
 
Are you trying to find the port or the actual binary that is executed when you launch the application?

If it's the latter, then whereis omxplayer is more appropriate.

If it's just a file (any file, anywhere), then use something like that: find /usr/local -name omxplayer*
 
I wanted different ways to try, So thanks for all the different ways.

Realistically find -name is enough. I would have never guessed the '-name embedded in quotes' part.

find / -name 'omxplayer*'
 
How would I restrict this search to one directory? For example:

find / -path '/usr' -name 'omxplayer*'

I could just move to the directory and run find(1)
 
find /usr -name 'omxplayer*'

To look up only in /usr without subdirectories try this.
find /usr -name 'omxplayer*' -maxdepth 1
 
That only seems to list directories though:

Code:
noot@Testing:/ # find /usr -name 'omxplayer*' -maxdepth 6
/usr/ports/multimedia/omxplayer
I tried it with -type f option too.
 
I have files and directories.

find / -name 'ports*' -maxdepth 3
Code:
/var/db/ports
/var/db/portsnap
/usr/sbin/portsnap
/etc/portsnap.conf
 
That only seems to list directories though:

Code:
noot@Testing:/ # find /usr -name 'omxplayer*' -maxdepth 6
/usr/ports/multimedia/omxplayer
I tried it with -type f option too.
Try find /usr/ports -name "*omxplayer*"
Code:
/usr/ports/multimedia/omxplayer
/usr/ports/multimedia/omxplayer/files/patch-omxplayer.cpp
 
Back
Top