Código: Seleccionar todo
find . -name "*.txt"- Buscar en el directorio personal (~) archivos que se denominen 'test':
Código: Seleccionar todo
guillermo@ordenador:~$ find ~ -name test
/home/guillermo/Documentos/Debian_Docs/WORKING/test
Código: Seleccionar todo
guillermo@ordenador:~$ find ~ -name test*
/home/guillermo/mc-4.8.31/tests
/home/guillermo/mc-4.8.31/tests/src/editor/test-data.txt.in
/home/guillermo/mc-4.8.31/tests/src/vfs/extfs/helpers-list/test_all
/home/guillermo/mc-4.8.31/tests/src/vfs/extfs/helpers-list/misc/rpm/test.spec
/home/guillermo/mc-4.8.31/config/test-driver
/home/guillermo/.cache/calibre/ev2/f/c1-sjmmlmc7/OEBPS/images/testkvm.png
/home/guillermo/WEB_DEV/wp-content/themes/twentytwentyfour/patterns/testimonial-centered.php
/home/guillermo/linuxEssentials/test-error2
/home/guillermo/linuxEssentials/emptydir/test.sh
/home/guillermo/gimp-2.10.34/test-driver
/home/guillermo/gimp-2.10.34/debian/tests
/home/guillermo/gimp-2.10.34/libgimpbase/test-cpu-accel.c
/home/guillermo/gimp-2.10.34/libgimpcolor/test-color-parser.c
/home/guillermo/gimp-2.10.34/libgimpwidgets/test-eevl.c
/home/guillermo/gimp-2.10.34/libgimpwidgets/test-preview-area.c
/home/guillermo/gimp-2.10.34/app/tests.c
/home/guillermo/gimp-2.10.34/app/operations/tests
/home/guillermo/gimp-2.10.34/app/tests.h
/home/guillermo/gimp-2.10.34/app/tests
/home/guillermo/gimp-2.10.34/app/tests/test-save-and-export.c
/home/guillermo/gimp-2.10.34/app/tests/test-core.c
/home/guillermo/gimp-2.10.34/app/tests/test-ui.c
/home/guillermo/gimp-2.10.34/app/tests/test-xcf.c
/home/guillermo/gimp-2.10.34/app/tests/test-single-window-mode.c
/home/guillermo/gimp-2.10.34/app/tests/test-session-2-8-compatibility-multi-window.c
/home/guillermo/gimp-2.10.34/app/tests/test-tools.c
/home/guillermo/gimp-2.10.34/app/tests/test-session-2-8-compatibility-single-window.c
/home/guillermo/gimp-2.10.34/app/tests/test-gimpidtable.c
/home/guillermo/gimp-2.10.34/app/config/test-config.c
/home/guillermo/gimp-2.10.34/plug-ins/script-fu/scripts/test-sphere.scm
/home/guillermo/gimp-2.10.34/desktop/test-appdata.sh.in
/home/guillermo/gimp-2.10.34/desktop/test-desktop.sh
/home/guillermo/Documentos/Debian_Docs/SACO/WEB/test_buscador.html
/home/guillermo/Documentos/Debian_Docs/MISCELANEA/test.txt
/home/guillermo/Documentos/Debian_Docs/TESTING/test2
/home/guillermo/Documentos/Debian_Docs/SERVICIO_INFORMATICA_LOCAL/FIRMA_CORREO/test.txt
/home/guillermo/Documentos/Debian_Docs/SERVICIO_INFORMATICA_LOCAL/FIRMA_CORREO/test.html
/home/guillermo/Documentos/Debian_Docs/SERVICIO_INFORMATICA_LOCAL/FIRMA_CORREO/test2.txt
/home/guillermo/Documentos/Debian_Docs/SERVICIO_INFORMATICA_LOCAL/FIRMA_CORREO/test3.html
/home/guillermo/Documentos/Debian_Docs/SERVICIO_INFORMATICA_LOCAL/FIRMA_CORREO/test2.html
/home/guillermo/Documentos/Debian_Docs/WORKING/test.html
/home/guillermo/Documentos/Debian_Docs/WORKING/testbat.bat
/home/guillermo/Documentos/Debian_Docs/WORKING/test
/home/guillermo/Nextcloud/SERVICIO_INFORMATICA/FIRMA_CORREO_OBSOLETO/test.txt
/home/guillermo/Nextcloud/SERVICIO_INFORMATICA/FIRMA_CORREO_OBSOLETO/test.html
/home/guillermo/Nextcloud/SERVICIO_INFORMATICA/FIRMA_CORREO_OBSOLETO/test2.txt
/home/guillermo/Nextcloud/SERVICIO_INFORMATICA/FIRMA_CORREO_OBSOLETO/test2.html
/home/guillermo/Nextcloud/WEB/test_buscador.html
guillermo@ordenador:~$
grep: Este comando se utiliza para buscar texto en archivos. Puedes buscar una cadena de texto específica en uno o más archivos. Por ejemplo, para buscar la palabra “hola” en el archivo archivo.txt, puedes usar:
Código: Seleccionar todo
grep "hola" archivo.txtlocate: Este comando se utiliza para buscar archivos y directorios en un sistema de archivos. A diferencia de find, locate utiliza una base de datos interna para buscar, lo que hace que la búsqueda sea más rápida. Sin embargo, la base de datos puede no estar siempre actualizada. Para buscar todos los archivos que contienen la palabra “ejemplo”, puedes usar:
Código: Seleccionar todo
locate ejemploCódigo: Seleccionar todo
plocate ejemplo