aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cli/find.md
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli/find.md')
-rw-r--r--src/cli/find.md31
1 files changed, 31 insertions, 0 deletions
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
+```