From d283aba52e737b8ac21742abd84c2046c00e9148 Mon Sep 17 00:00:00 2001 From: David Peter Date: Sun, 14 Feb 2021 19:51:10 +0100 Subject: [PATCH] Move command execution section --- README.md | 66 +++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 9032655..c0e1451 100644 --- a/README.md +++ b/README.md @@ -137,39 +137,6 @@ target/debug/deps/libnum_cpus-f5ce7ef99006aa05.rlib To really search *all* files and directories, simply combine the hidden and ignore features to show everything (`-HI`). -### Excluding specific files or directories - -Sometimes we want to ignore search results from a specific subdirectory. For example, we might -want to search all hidden files and directories (`-H`) but exclude all matches from `.git` -directories. We can use the `-E` (or `--exclude`) option for this. It takes an arbitrary glob -pattern as an argument: -``` bash -> fd -H -E .git … -``` - -We can also use this to skip mounted directories: -``` bash -> fd -E /mnt/external-drive … -``` - -.. or to skip certain file types: -``` bash -> fd -E '*.bak' … -``` - -To make exclude-patterns like these permanent, you can create a `.fdignore` file. They work like -`.gitignore` files, but are specific to `fd`. For example: -``` bash -> cat ~/.fdignore -/mnt/external-drive -*.bak -``` -Note: `fd` also supports `.ignore` files that are used by other programs such as `rg` or `ag`. - -If you want `fd` to ignore these patterns globally, you can put them in `fd`'s global ignore file. -This is usually located in `~/.config/fd/ignore` in macOS or Linux, and `%APPDATA%\fd\ignore` in -Windows. - ### Command execution Instead of just showing the search results, you often want to *do something* with them. `fd` @@ -234,6 +201,39 @@ If you do not include a placeholder, *fd* automatically adds a `{}` at the end. For `-x`/`--exec`, you can control the number of parallel jobs by using the `-j`/`--threads` option. Use `--threads=1` for serial execution. +### Excluding specific files or directories + +Sometimes we want to ignore search results from a specific subdirectory. For example, we might +want to search all hidden files and directories (`-H`) but exclude all matches from `.git` +directories. We can use the `-E` (or `--exclude`) option for this. It takes an arbitrary glob +pattern as an argument: +``` bash +> fd -H -E .git … +``` + +We can also use this to skip mounted directories: +``` bash +> fd -E /mnt/external-drive … +``` + +.. or to skip certain file types: +``` bash +> fd -E '*.bak' … +``` + +To make exclude-patterns like these permanent, you can create a `.fdignore` file. They work like +`.gitignore` files, but are specific to `fd`. For example: +``` bash +> cat ~/.fdignore +/mnt/external-drive +*.bak +``` +Note: `fd` also supports `.ignore` files that are used by other programs such as `rg` or `ag`. + +If you want `fd` to ignore these patterns globally, you can put them in `fd`'s global ignore file. +This is usually located in `~/.config/fd/ignore` in macOS or Linux, and `%APPDATA%\fd\ignore` in +Windows. + ### Deleting files You can use `fd` to remove all files and directories that are matched by your search pattern.