aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-20 21:25:46 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2025-02-20 21:25:46 +0100
commitce1598198ea4878edc97df16d9061be75eca7b9b (patch)
treeff605244943c52c93384c34e0ca1cff59039d54a /src
parent94a774fab936fef4b3218973c35543c19dae11d8 (diff)
downloadnotes-ce1598198ea4878edc97df16d9061be75eca7b9b.tar.gz
notes-ce1598198ea4878edc97df16d9061be75eca7b9b.zip
find: initial notes
Diffstat (limited to 'src')
-rw-r--r--src/SUMMARY.md1
-rw-r--r--src/cli/README.md1
-rw-r--r--src/cli/find.md31
3 files changed, 33 insertions, 0 deletions
diff --git a/src/SUMMARY.md b/src/SUMMARY.md
index 4a606f4..c1f7cca 100644
--- a/src/SUMMARY.md
+++ b/src/SUMMARY.md
@@ -19,6 +19,7 @@
- [paste](./cli/paste.md)
- [xargs](./cli/xargs.md)
- [grep](./cli/grep.md)
+ - [find](./cli/find.md)
- [Tools](./tools/README.md)
- [tmux](./tools/tmux.md)
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
+```