31-08-2021
This commit is contained in:
108
docs/Linux/fd.md
108
docs/Linux/fd.md
@@ -12,7 +12,7 @@ choco install fd
|
||||
|
||||
|
||||
|
||||
Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
||||
##### Recherche un fichier dans le répertoire courant (et sous-dossiers):
|
||||
|
||||
```bash
|
||||
~ master* ⇡
|
||||
@@ -25,41 +25,42 @@ pip/pip.conf
|
||||
|
||||
```
|
||||
|
||||
Recherche dans un répertoire particulier:
|
||||
##### Recherche dans un répertoire particulier:
|
||||
|
||||
```bash
|
||||
~ master* ⇡
|
||||
❯ fd -HI 'id_*' .ssh
|
||||
$ fd -HI 'id_*' .ssh
|
||||
.ssh/id_ed25519
|
||||
.ssh/id_ed25519.pub
|
||||
.ssh/id_rsa
|
||||
.ssh/id_rsa.pub
|
||||
.ssh/id_rsa.zip
|
||||
|
||||
❯ fd -HI 'id_*' $HOME/.ssh
|
||||
/Users/bruno/.ssh/id_ed25519
|
||||
/Users/bruno/.ssh/id_ed25519.pub
|
||||
/Users/bruno/.ssh/id_rsa
|
||||
/Users/bruno/.ssh/id_rsa.pub
|
||||
```
|
||||
|
||||
Recherche par regex:
|
||||
##### Recherche par regex:
|
||||
|
||||
```bash
|
||||
~ master* ⇡ 4m 27s
|
||||
❯ fd -HI '^h.*.conf$' /etc
|
||||
/etc/apache2/extra/httpd-autoindex.conf
|
||||
/etc/apache2/extra/httpd-dav.conf
|
||||
/etc/apache2/extra/httpd-default.conf
|
||||
/etc/apache2/extra/httpd-info.conf
|
||||
/etc/apache2/extra/httpd-languages.conf
|
||||
/etc/apache2/extra/httpd-manual.conf
|
||||
/etc/apache2/extra/httpd-mpm.conf
|
||||
/etc/apache2/extra/httpd-multilang-errordoc.conf
|
||||
/etc/apache2/extra/httpd-ssl.conf
|
||||
/etc/apache2/extra/httpd-userdir.conf
|
||||
/etc/apache2/extra/httpd-vhosts.conf
|
||||
/etc/apache2/httpd.conf
|
||||
$ fd -I '^.*.conf$' /opt
|
||||
/opt/homebrew/share/autoconf
|
||||
/opt/homebrew/share/user_map.conf
|
||||
/opt/homebrew/Cellar/mariadb/10.6.4/share/user_map.conf
|
||||
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/groonga.conf
|
||||
/opt/homebrew/Cellar/groonga/11.0.5/etc/groonga/httpd/fastcgi.conf
|
||||
...
|
||||
|
||||
$ fd -H '^.*.conf$' /opt
|
||||
|
||||
$
|
||||
```
|
||||
|
||||
https://docs.rs/regex/1.0.0/regex/#syntax
|
||||
|
||||
Fichiers se terminant par *'[0-9].jpg'*:
|
||||
##### Fichiers se terminant par *'[0-9].jpg'*:
|
||||
|
||||
```bash
|
||||
$ fd -HI '.*[0-9]\.jpg$' ~
|
||||
@@ -67,17 +68,74 @@ $ fd -HI '.*[0-9]\.jpg$' ~
|
||||
$ find ~ -iname '*[0-9].jpg'
|
||||
```
|
||||
|
||||
Sans arguments:
|
||||
##### Sans arguments:
|
||||
|
||||
```bash
|
||||
# afficher tous les entrées du répertoire courant
|
||||
$ fd
|
||||
|
||||
# afficher tous les entrées d'un répertoire
|
||||
$ fd . $HOME/.ssh
|
||||
/Users/bruno/.ssh/config
|
||||
/Users/bruno/.ssh/id_ed25519
|
||||
/Users/bruno/.ssh/id_ed25519.pub
|
||||
/Users/bruno/.ssh/id_rsa
|
||||
/Users/bruno/.ssh/id_rsa.pub
|
||||
/Users/bruno/.ssh/known_hosts
|
||||
```
|
||||
|
||||
##### Chercher un fichier précis:
|
||||
|
||||
```bash
|
||||
$ fd -I -g php.ini /opt
|
||||
/opt/homebrew/etc/php/7.4/php.ini
|
||||
/opt/homebrew/etc/php/8.0/php.ini
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Option:
|
||||
|
||||
- **-H, --hidden**: cherche dans les fichiers et dossiers cachés
|
||||
- **-I, --no-ignore**: cherche dans les fichiers et dossiers ignorés par '.gitignore', '.ignore', '.fdignore'
|
||||
- **-x, --exec <cmd>**: exécute une commande pour chaque résultat
|
||||
- **-X, --exec-batch <cmd>**: exécute une commande pour tous les résultats en même temps
|
||||
- **-s, --case-sensitive**:
|
||||
- **-i, --ignore-case**: (défaut)
|
||||
- **-l, --list-details**
|
||||
- **-L, --follow**: suit les liens symboliques (pas par défaut)
|
||||
- **-d, --max-depth <depth>**: limite le nombre de répertoires traversés (pas de limite par défaut)
|
||||
- **-t, --type <filetype>...**: filtre par type de fichiers
|
||||
- 'f' or 'file': fichiers réguliers
|
||||
- 'd' or 'directory': répertoires
|
||||
- 'l' or 'symlink': liens symboliques
|
||||
- 'x' or 'executable': executables
|
||||
- 'e' or 'empty': fichiers vides ou répertoires
|
||||
- 's' or 'socket': socket
|
||||
- 'p' or 'pipe': named pipe (FIFO)
|
||||
- **-e, --extension <ext>...**: filtre par extension (plusieurs autorisées)
|
||||
- **-E, --exclude <pattern>...**: exclure des fichiers/répertoires des résultats (--exclude '*.pyc', --exclude node_modules)
|
||||
- **-c, --color <when>**: colorie chaque chaine trouvée ('auto', 'never', 'always')
|
||||
- **-S, --size <size>...**: filtre par la taille des fichiers (+3k, -500, +1g, 300)
|
||||
- **--changed-within <date|dur>**: filtre par la date de modification
|
||||
- --changed-within 2 weeks (10h, 1d, 35min)
|
||||
- --change-newer-than '2018-10-27 10:00:00'
|
||||
- **--changed-before <date|dur>**: filtre par la date de modification
|
||||
- --changed-before '2018-10-27 10:00:00'
|
||||
- --change-older-than 2weeks (10h, 1d, 35min)
|
||||
- **-o, --owner <user:group>**: filtre par utilisateur/groupe (--owner bruno, --owner :staff, --owner '!john:students')
|
||||
- **--max-results <count>**: limite le nombre de résultats à 'count' et quitte
|
||||
|
||||
|
||||
Option:
|
||||
|
||||
- --hidden: cherche dans les dossiers cachés
|
||||
- --no-ignore:
|
||||
- -x / --exec:
|
||||
```bash
|
||||
# -l, --list-details
|
||||
|
||||
$ fd -Il '^.*.conf$' /opt/homebrew/etc
|
||||
-rw-r--r-- 1 bruno admin 696 jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-hinting-slight.conf
|
||||
-rw-r--r-- 1 bruno admin 2,2K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
|
||||
-rw-r--r-- 1 bruno admin 1,6K jul 24 07:46 /opt/homebrew/etc/fonts/conf.d/20-unhint-small-vera.conf
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user