List only file names in directories and subdirectories in bash

Viewed 4853

I need to create a list of files in a directory and all of its subdirectories. I've used

find . -type f

to get the list of files, but I only need the file name, not the path that leads to it.

So instead of returning this:

./temp2/temp3/file3.txt
./temp2/file2.txt
./file.txt

I need to return

file3.txt
file2.txt
file.txt
4 Answers
Related