find . -type f -print
prints out
./file1
./file2
./file3
Any way to make it print
file1
file2
fil
it can be shorter
find * -type f
Use sed
find . | sed "s|^\./||"
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.
Since -printf
option is not available on OSX find
here is one command that works on OSX find, just in case if someone doesn't want to install gnu find
using brew
etc:
find . -type f -execdir printf '%s\n' {} +
Another way of stripping the ./
find * -type d -maxdepth 0
Another way of stripping the ./
is by using cut
like:
find -type f | cut -c3-
Further explanation can be found here