i wanna search for the catalogs which have the "program" in their names and echo these names in console. I have wrote this, but isn't working:
find usr -type d -name "program" -exec echo {}
The error is find: missing argument to `-exec'.
find usr -type d -name "program"
usr/lib64/libreofice/program
How to fix my command?
Some tiny example with the *
wildcard.
find /my/path -name "*program*"
If you don' use wildcards, it will try to find exactly the files named program
. Also, echoing is done automatically, you don't need the exec
command.
Update Answering to your comment. You can get the base name (name without the path) with:
find . -name "*program*" -exec basename {} \;