find . -type f -print
prints out
./file1
./file2
./file3
Any way to make it print
file1
file2
file3
?
If they're only in the current directory
find * -type f -print
Is that what you want?
Ilia K.
Find only regular files under current directory, and print them without "./
" prefix:
find -type f -printf '%P\n'
From man find, description of -printf
format:
%P File's name with the name of the command line argument under which it was found removed.
Use sed
find . | sed "s|^\./||"
it can be shorter
find * -type f
来源:https://stackoverflow.com/questions/2596462/how-to-strip-leading-in-unix-find