mirror of
https://github.com/sharkdp/fd
synced 2024-10-02 22:13:31 +00:00
Move command execution section
This commit is contained in:
parent
5423c45660
commit
d283aba52e
66
README.md
66
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.
|
||||
|
|
Loading…
Reference in a new issue