diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-02-20 21:25:46 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-02-20 21:25:46 +0100 |
commit | ce1598198ea4878edc97df16d9061be75eca7b9b (patch) | |
tree | ff605244943c52c93384c34e0ca1cff59039d54a /src/cli | |
parent | 94a774fab936fef4b3218973c35543c19dae11d8 (diff) | |
download | notes-ce1598198ea4878edc97df16d9061be75eca7b9b.tar.gz notes-ce1598198ea4878edc97df16d9061be75eca7b9b.zip |
find: initial notes
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/README.md | 1 | ||||
-rw-r--r-- | src/cli/find.md | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/src/cli/README.md b/src/cli/README.md index 6b7a661..ffde988 100644 --- a/src/cli/README.md +++ b/src/cli/README.md @@ -11,3 +11,4 @@ - [paste](./paste.md) - [xargs](./xargs.md) - [grep](./grep.md) +- [find](./find.md) diff --git a/src/cli/find.md b/src/cli/find.md new file mode 100644 index 0000000..9597cdb --- /dev/null +++ b/src/cli/find.md @@ -0,0 +1,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 +``` |