# Búsqueda de archivos y directorios

## Rutas

```sh
/var/backups
/var/www
/opt
/mnt
ls -lsaRH /home
ls -lsaRH /root
```

## Búsqueda por nombre de archivo

```sh
find / -name <name> 2>/dev/null
find / -name <name> 2>/dev/null -not -path "/<directory>*"
```

## Búsqueda por grupo de usuario

```sh
find / -group <group> 2>/dev/null
```

## Búsqueda por extensión de archivo <a href="#busqueda-por-extension-de-archivo" id="busqueda-por-extension-de-archivo"></a>

```sh
find / -regex ".*\.\(bak\|zip\)" 2>/dev/null
find / -regex ".*\.\(txt\|doc\|csv\)" 2>/dev/null -exec grep -Iq . {} \; -printf "\n%p: " -exec cat {} \;
```

## Búsqueda de directorios con privilegios de escritura <a href="#busqueda-por-extension-de-archivo" id="busqueda-por-extension-de-archivo"></a>

```sh
find / -writable -type d 2>/dev/null
find / -writable -type d -prune -o -name <exclude-directory> 2>/dev/null
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pentesting.mrw0l05zyn.cl/escalamiento-de-privilegios/linux-unix/busqueda-de-archivos-y-directorios.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
