0Pricing
Linux Command Line Mastery · 강의

파일 검색: `find`와 `locate`

다양한 기준에 따라 시스템 전체에서 파일과 디렉터리를 효율적으로 검색하는 강력한 도구를 알아봅니다.

파일 검색: `find`와 `locate`은(는) CoddyKit의 무료 Linux Command Line Mastery 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Linux Command Line Mastery 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Linux Command Line Mastery 강의에는 총 4개의 강의가 포함되어 있습니다.

이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.

Find Your Files!

Ever lost a file or needed to find all documents of a certain type on your Linux system? It happens to everyone!

The Linux terminal offers powerful tools to help you search for files and directories efficiently. In this lesson, we'll explore two essential commands: locate and find.

`locate`: The Quick Search

First up is locate. This command is incredibly fast because it doesn't search your filesystem directly in real-time. Instead, it queries a pre-built database of all files on your system.

Think of it like searching an index in a book – it's quick, but the index might not always be perfectly up-to-date.

Basic `locate` Usage

Using locate is straightforward. Just type locate followed by the filename or pattern you're looking for. It will show you all paths that contain that string.

For example, to find all files named "my_document.txt":

locate my_document.txt

Updating `locate`'s Database

Since locate uses a database, its results can sometimes be outdated if new files have been created or deleted since the last database update.

To refresh the database, you can run the updatedb command. This usually requires administrator (root) privileges:

sudo updatedb

`find`: The Real-Time Search

While locate is fast, find is much more powerful and always up-to-date. Instead of a database, find actively traverses your filesystem in real-time, checking every file and directory against your criteria.

This makes find slower than locate for simple searches, but it's perfect for complex, real-time, and precise searches.

`find` Command Structure

The basic syntax for find is:

find [path] [expression]

`find` by Name

One of the most common ways to use find is to search for files by their name. You use the -name option, and you can include wildcards like * (any characters) and ? (any single character).

To find all files ending with .log in your home directory:

find /home -name "*.log"

`find` by File Type

find can also filter results by file type. This is super useful when you only want to see directories or regular files.

  • -type f: Searches for regular files.
  • -type d: Searches for directories.

To find all directories starting with "project" in the current location:

find . -type d -name "project*"

`find` by File Size

Need to find large files taking up space? The -size option is your friend! You can specify sizes using suffixes like c (bytes), k (kilobytes), M (megabytes), G (gigabytes).

  • +: Greater than specified size.
  • -: Less than specified size.
  • No prefix: Exactly specified size.

Example: Find files larger than 10MB in the current directory.

find . -size +10M -name "*.zip"

Comparing Search Tools

You've learned about locate and find. Which of the following statements about these commands are TRUE?

Recap: Finding Files

Great job! You now have two powerful tools for searching files on your Linux system:

  • locate: Fast, database-driven searches. Great for quick checks but needs updatedb for freshness.
  • find: Slower but real-time, powerful, and highly customizable. Essential for complex searches by name, type, size, and more.

Practice using both commands to become a master file finder!

자주 묻는 질문

“파일 검색: `find`와 `locate`” 강의는 무료인가요?

네 — “파일 검색: `find`와 `locate`” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Linux Command Line Mastery 강의 전체를 잠금 해제할 수 있습니다. Linux Command Line Mastery 강의에는 총 4개의 강의가 포함되어 있습니다.

“파일 검색: `find`와 `locate`”에서 뭘 배우나요?

다양한 기준에 따라 시스템 전체에서 파일과 디렉터리를 효율적으로 검색하는 강력한 도구를 알아봅니다. 브라우저에서 직접 실행하는 실습 코드로 Linux Command Line Mastery을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.

Linux Command Line Mastery을(를) 시작하는 데 경험이 필요한가요?

사전 경험은 필요하지 않습니다. CoddyKit의 Linux Command Line Mastery은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.

“파일 검색: `find`와 `locate`” 강의는 얼마나 걸리나요?

대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.

이 Linux Command Line Mastery 강의에서 코드를 작성하고 실행할 수 있나요?

네. 모든 Linux Command Line Mastery 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.

이 강의의 모든 강의

  1. 파일 내용 보기: `cat`, `less`, `more`
  2. 파일 검색: `find`와 `locate`
  3. 권한 및 소유권: `chmod`, `chown`
  4. 기호 링크 만들고 따라가기
← Linux Command Line Mastery(으)로 돌아가기