The Computer Oracle

*nix find -type flag: can it accept multiple types?

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Switch On Looping

--

Chapters
00:00 *Nix Find -Type Flag: Can It Accept Multiple Types?
01:09 Accepted Answer Score 14
01:36 Thank you

--

Full question
https://superuser.com/questions/701805/n...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#linux #commandline #bash #unix #find

#avk47



ACCEPTED ANSWER

Score 14


# Apply to only link or file type directory entries:
$ find . \( -type l -o -type f \) -name node-dev -exec ls -lah {} \;
# Apply to anything but a directory - add more with -o in between "\(" & "\)" meta-characters:
$ find . ! \( -type d \) -name node-dev -exec ls -lah {} \;

Note that on the find command, there is a -ls switch which could replaces the -exec call, keeping in mind that find can be slow to begin with, but having to create a new process for each found file does use system resources better utilized elsewhere.