Introduction to File Operations
Mastering file operations is crucial for navigating and modifying codebases effectively with the Gemini CLI. This lesson covers searching, reading with pagination, and precise editing techniques.
Searching with glob
The glob tool is your primary way to find files based on patterns. It's much faster than manually listing directories when you know what you're looking for.
- Use
**/*.tsto find all TypeScript files recursively. - Use
src/components/*.tsxto find React components in a specific folder. - The tool returns absolute paths, which are required by other file tools.
Reading Large Files with read_file
Reading huge files all at once can exceed token limits or become overwhelming. The read_file tool supports offset and limit for pagination.