Finding files with find · find로 파일 찾기
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Searching the whole tree
lsshows one folder.findsearches a folder and everything inside it, however deep:
.means "start in the current folder".findlists every file and folder it can reach.
한국어
전체 트리 검색
ls는 하나의 폴더만 보여줍니다.find은 폴더 그리고 그 안에 들어간 모든 것, 얼마나 깊게든 검색합니다:
find .
.는 "현재 폴더에서 시작"을 의미합니다.find은 도달 가능한 모든 파일과 폴더를 나열합니다.
English
Find by name
- Usually you want files matching a pattern. Use
-name:
- This finds every
.txtfile in the tree — even ones buried three folders down. - Quote the pattern (
"*.txt") so the shell passes it tofinduntouched.
한국어
이름으로 찾기
- 보통은 패턴에 맞는 파일을 원합니다.
-name를 사용하세요:
find . -name "*.txt"
- 이는 트리 내의 모든
.txt파일을 찾습니다 — 폴더 세 개 아래에 숨어 있어도 말입니다. - 패턴을 묶어(
"*.txt") 쉘이 그대로find에 전달하도록 하세요.
English
Why it is handy
- "Where did I put that file?" —
findanswers it in one line. - Combined with pipes, you can act on the results — for example count them with
wc -l.
한국어
유용한 이유
- "그 파일 어디에 뒀지?" —
find가 한 줄로 답변해 줍니다. - 파이프와 결합하면 결과에 작업할 수 있습니다 — 예를 들어
wc -l로 개수를 세는 것입니다.
English
Common mistakes
find . -name "*.txt"searches by name from the current folder down.- Quote the pattern so the shell does not expand it first.
한국어
흔한 실수
find . -name "*.txt"는 현재 폴더부터 아래로 이름으로 검색합니다.- 패턴을 묶어 쉘이 먼저 확장하지 않도록 하세요.
Explore · 탐색하기
find walks the tree · find는 트리를 탐색합니다
find searches the whole tree below a directory. · find는 디렉토리 아래 전체 트리를 검색합니다.
Find every .txt file, even deep inside subfolders, with find . -name "*.txt". (. means "start from here".) · .txt 파일을 서브폴더 깊숙이까지도 find . -name "*.txt"로 찾으십시오. (.는 "여기서 시작"을 의미합니다.)
You can also start the search from a subfolder. Find just the .txt files inside docs (and below) with find docs -name "*.txt". · 검색을 서브폴더에서 시작할 수도 있습니다. .txt 파일을 docs 내부(이하)에서만 find docs -name "*.txt"로 찾으십시오.