Find all files in a directory that are not directories themselves Find all files in a directory that are not directories themselves bash bash

Find all files in a directory that are not directories themselves


If you want test.log, test2.log, and file2 then:

find . -type f

If you do not want file2 then:

find . -maxdepth 1 -type f


If you need symlinks, pipes, device files and other specific elements of file system to be listed too, you should use:

find -maxdepth 1 -not -type d

This will list everything except directories.


using find is simple as:

find . -maxdepth 1 -type f