Searching and reading

List the entries of a directory

List the files and directories directly under a project directory.

list "/home/user/app"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n"},{"path":"/home/user/app/docs","type":"dir"}]}
/home/user/app/main.go
ls -la /home/user/app
Get-ChildItem C:\Users\user\app

Find the largest Go files changed in the last day

Find Go files larger than 1 MB that changed in the last 24 hours, largest first.

find "/home/user/app" glob: "**/*.go"
|> filter size > 1mb and modified > ago(24h)
|> sort size order: desc
|> first 20
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/gen/schema.go","type":"file","content_utf8":"package gen\n"}]}
matched 0
find /home/user/app -name '*.go' -size +1M -mtime -1 -printf '%s %p\n' | sort -rn | head -20
Get-ChildItem C:\Users\user\app -Recurse -Filter *.go | Where-Object { $_.Length -gt 1MB -and $_.LastWriteTime -gt (Get-Date).AddDays(-1) } | Sort-Object Length -Descending | Select-Object -First 20

Count the files of one type

Count the TypeScript files of a project.

find "/home/user/app" glob: "**/*.ts" |> count
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/a.ts","type":"file","content_utf8":""},{"path":"/home/user/app/b.ts","type":"file","content_utf8":""}]}
2
find /home/user/app -name '*.ts' | wc -l

Find files by a name fragment

Find files whose name contains the word config, in any directory.

find "/home/user/app" glob: "**/*config*"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/config.toml","type":"file","content_utf8":""},{"path":"/home/user/app/src/main.rs","type":"file","content_utf8":""}]}
/home/user/app/config.toml
find /home/user/app -name '*config*'

Find a text pattern in source files

Find every call of a function in the Go files of a directory.

search /oldName\(/ "/home/user/app/src" glob: "**/*.go"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/src/a.go","type":"file","content_utf8":"x := oldName(1)\n"}]}
/home/user/app/src/a.go
grep -rn 'oldName(' --include='*.go' /home/user/app/src
Get-ChildItem C:\Users\user\app\src -Recurse -Filter *.go | Select-String 'oldName\('

List the files that contain a pattern

List only the paths of the files that contain a pattern, without the matching lines.

search /pending/ "/home/user/app/src" output: files
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/src/a.go","type":"file","content_utf8":"// pending\n"},{"path":"/home/user/app/src/b.go","type":"file","content_utf8":"x\n"}]}
/home/user/app/src/a.go
grep -rl 'pending' /home/user/app/src

Search without regard to letter case

Search for a word in a log file and accept any letter case.

search "error" "/home/user/app/app.log" case_sensitive: false
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/app.log","type":"file","content_utf8":"ok\nERROR disk full\n"}]}
disk full
grep -in 'error' /home/user/app/app.log

Show context around a match

Show three lines before and after each match of a pattern.

search /panic/ "/home/user/app/app.log" context: 3
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/app.log","type":"file","content_utf8":"a\nb\npanic: boom\nc\n"}]}
panic: boom
grep -C 3 'panic' /home/user/app/app.log

Read a file

Read the whole content of a text file.

read "/home/user/app/README.md"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/README.md","type":"file","content_utf8":"# App\n"}]}
# App
cat /home/user/app/README.md
Get-Content C:\Users\user\app\README.md

Read a range of lines

Read lines 10 to 20 of a source file with line numbers.

read "/home/user/app/main.go" lines: 10..20 line_numbers: true
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n"}]}
main.go
sed -n '10,20p' /home/user/app/main.go

Read the last lines of a log

Read the last 50 lines of a log file.

read "/home/user/app/app.log" last: 50
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/app.log","type":"file","content_utf8":"started\n"}]}
started
tail -n 50 /home/user/app/app.log
Get-Content C:\Users\user\app\app.log -Tail 50

Read the lines around a pattern

Read the lines around the first line that matches a pattern.

read "/home/user/app/main.go" around: /func main/ context: 3
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n\nfunc main() {}\n"}]}
func main

Show the metadata of a file

Show the size, times and permissions of a file together with its SHA-256 hash.

info "/home/user/app/main.go" hash: sha256
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n"}]}
/home/user/app/main.go
stat /home/user/app/main.go && sha256sum /home/user/app/main.go

Count the lines of a file

Count the lines of a file.

lines "/home/user/app/main.go" |> count
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"a\nb\nc\n"}]}
3
wc -l /home/user/app/main.go

List a directory by modification time

List the entries of a directory, the most recently modified first.

list "/home/user/app" sort: modified order: desc
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n"},{"path":"/home/user/app/go.mod","type":"file","content_utf8":"module app\n"}]}
/home/user/app/main.go
ls -lt /home/user/app

Find only directories

Find the directories of a project whose name contains test.

find "/home/user/app" type: directory glob: "**/*test*"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/tests","type":"dir"},{"path":"/home/user/app/src","type":"dir"}]}
/home/user/app/tests
find /home/user/app -type d -name '*test*'

Find files without dependency and build directories

Find JavaScript files and skip dependency and build directories.

find "/home/user/app" glob: "**/*.js" exclude_preset: [deps, build]
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/index.js","type":"file","content_utf8":""},{"path":"/home/user/app/node_modules/x/index.js","type":"file","content_utf8":""}]}
/home/user/app/index.js

Search for a whole word

Find the word id and skip longer words that contain it.

search "id" "/home/user/app/src" whole_word: true
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/src/a.go","type":"file","content_utf8":"x := id\ny := width\n"}]}
x := id
grep -rnw 'id' /home/user/app/src

Count the matches per file

Count the lines that contain a pattern in every file.

search /deprecated/ "/home/user/app/src" output: counts
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/src/a.go","type":"file","content_utf8":"// deprecated a\n// deprecated b\n"}]}
/home/user/app/src/a.go
grep -rc 'deprecated' /home/user/app/src

List the files without a pattern

List the files that do not contain a license notice.

search /Copyright/ "/home/user/app/src" glob: "**/*.go" output: unmatched
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/src/a.go","type":"file","content_utf8":"// Copyright 2026\n"},{"path":"/home/user/app/src/b.go","type":"file","content_utf8":"package b\n"}]}
/home/user/app/src/b.go
grep -rL 'Copyright' --include='*.go' /home/user/app/src

Extract only the matching text

Extract the version numbers from a file without the rest of the line.

search /v\d+\.\d+\.\d+/ "/home/user/app/CHANGELOG.md" only_matching: true
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/CHANGELOG.md","type":"file","content_utf8":"## v1.2.3\n"}]}
v1.2.3
grep -oE 'v[0-9]+\.[0-9]+\.[0-9]+' /home/user/app/CHANGELOG.md

Search a pattern that spans lines

Find a function that starts with an empty body.

search /func main\(\) \{\n\}/ "/home/user/app/main.go" multiline: true
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"func main() {\n}\n"}]}
func main

Read one function

Read the definition of a function by its name.

read "/home/user/app/main.go" symbol: "main"
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n\nfunc main() {}\n"}]}
func main

Read the outline of a file

Read the declarations of a file without their bodies.

read "/home/user/app/main.go" view: outline
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n\nfunc main() {}\n"}]}
main

Show the metadata of several files

Show the metadata of two files in one call.

info ["/home/user/app/main.go", "/home/user/app/go.mod"]
{"format":"nurt-fs-snapshot/1","entries":[{"path":"/home/user/app/main.go","type":"file","content_utf8":"package main\n"},{"path":"/home/user/app/go.mod","type":"file","content_utf8":"module app\n"}]}
/home/user/app/go.mod
stat /home/user/app/main.go /home/user/app/go.mod

Source file on GitHub: docs/cookbook/search-and-read.md