aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cli/find.md
blob: 9597cdbf39f0f1dd7e556e5147017593281ea1d6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# find(1)

```
find <start> [opts]
    -maxdepth <n>        maximally search n dirs deep
    -type <t>            match on file type
                           f    regular file
                           d    directory
    -user <name>         list files owned by username
    -name <glob>         list files matching glob (only filename)
    -iname <glob>        list files matching glob case-insensitive

    -exec <cmd> {} ;     run cmd on each file
    -exec <cmd> {} +     run cmd with all files as argument
```
> Depending on the shell the `<glob>` must be quoted or escaped. The
> exec modifier characters `;` and `+` also may need to be escaped.

### Example `-exec` option
```sh
> find . -maxdepth 1 -type d -exec echo x {} \;
# x .
# x ./.github
# x ./book
# x ./src
# x ./.git
# x ./docs

> find . -maxdepth 1 -type d -exec echo x {} +
# x . ./.github ./book ./src ./.git ./docs
```