find command finds things

작성자

카테고리:

← 피드로
DEV Community · Eric Chen · 2026-07-16 개발(SW)
Cover image for find command finds things

Eric Chen

Recently I learned: find is a useful command to find files in your directories.

find folder1 folder2 folder3

Enter fullscreen mode Exit fullscreen mode

This dumps every file and directory under those folders.

It also supports flags such as -name "*.txt" to find files matching a particular pattern. There are also filters for size, permissions, and last modified date.

I’m thinking this would be a great tool for sanity-testing code that creates nested directories (like a new Docker container’s filesystem). This command will give me a full flat listing of the resulting tree (like a deeply nested ls command`).

The downside is of course it can dump a lot of output, but in sanity-testing scenarios, there shouldn’t be that many files anyways.

Something interesting is that this command will take multiple folders before the flags. I’m used to thinking of programs where the arguments are all positionally ordered, so if you don’t pass a flag it just assumes the next thing is a regular argument. In this case, find checks whether an argument looks like a flag (starts with -) before deciding whether to treat it as a path or as part of the expression. I wonder if this is a common pattern across other Linux commands. (Claude says find is special case, but I need to look more into this.)

원문에서 계속 ↗

추출 본문 · 출처: dev.to · https://dev.to/echen4628/find-command-finds-things-506

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다