I need a regex expression to use along with
find to find all the files which name start with a given string, for example
I tried with
find . -regex '^proc*' but it gives me no results.
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
It would be better to use just the
-name 'proc*' in this case, which uses globbing, and searches through the filename only (unlike
-regex which searches through the whole directory entries leading to the filename).
If you insist on using
-regex, leveraging greediness:
find . -type f -regex '.*/proc[^/]*$'