Ubuntu – Find executable filenames without path

find

I have a folder with many executables, and I want to omit the path in the results of the find command.
this command shows the files I want to see, but it also lists the path; I just want the file name.

find /opt/g09 -maxdepth 1 -executable

how can I get the output of find to show only the filenames, and not the full path?

Best Answer

Or use:

find /opt/g09 -maxdepth 1 -executable -printf "%f\n"

adding the -type f flag also works here.

From the find manual:

 %f     File's name with any leading directories removed (only the last element).

This answer only requires that you have GNU find whereas others require other programs to manipulate your results.