> For the complete documentation index, see [llms.txt](https://0xdecaf2bad.gitbook.io/red-team-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://0xdecaf2bad.gitbook.io/red-team-notes/08-commands/linux.md).

# linux

LINUX

## ###############################\#

Ping Sweep

for i in `seq 1 255`; do ping -c 1 172.16.1.$i | tr \n ' ' | awk '/1 received/ {print $2}'; done

## ###############################\#

Enumeration

find hidden files find . -type f -name '\*.py' <----you can edit this to find php, py, html, txt, whatever file you want.

Find writeable files in a linux box IE, if you want to download an exploit etc etc

find / -writable -type d 2>/dev/null # world-writeable folders find / -perm -222 -type d 2>/dev/null # world-writeable folders find / -perm -o w -type d 2>/dev/null # world-writeable folders

find / -perm -o x -type d 2>/dev/null # world-executable folders

find / ( -perm -o w -perm -o x ) -type d 2>/dev/null # world-writeable & executable folders

find / -perm -2 ! -type l -ls 2>/dev/null # world readable and writeable folders - maybe a cron job running as root :)

find / -type f -exec grep -l "flag.txt" {} \\; ##Find a file with a particular name

find filtering by path, filename, and permissions

find /path -iname "FILTER" -perm PERM

find with flags used to list or delete files found

find /path -iname "FILTER" -ls

find with grep to quickly identify files of interest

find /path -iname "FILTER" -exec grep -i "CONTENT" {} \\;

find things like shadow\.bak etc

find / -iname "shadow\*"

find with flags used to list or delete files found (w/error redirection) find / -iname "shadow\*" -ls 2>/dev/null

find results can also be filtered by file permissions as well (-perm) flag find / -iname "shadow\*" -perm /o+r -ls 2>/dev/null

find with grep to search for strings inside of files: find /home -iname "\*.txt" 2>/dev/null -exec grep -i 'pass' {} \\;

find with grep to quickly identify files of interest: find /home -iname "\*.txt" 2>/dev/null -exec grep -li 'pass' {} \\;

find with egrep to quickly identify files of interest using regular expressions: find /home -iname "\*.txt" 2>/dev/null -exec egrep -li "^.+\@.+$" {} \\;

Syntax: Recursively list all hidden files and directories on Linux/Unix

The basic syntax is as follows:

find /dir/to/search/ -name ".\*" -print

OR

find /dir/to/search/ -name ".\*" -ls

OR search only hidden files:

find /dir/to/search/ -type f -iname ".\*" -ls

OR search only hidden directories:

find /dir/to/search/ -type d -iname ".\*" -ls

OR

find /dir/to/search -path '*/.*' -print find /dir/to/search -path '*/.*' -ls

Find files based in attributes e.g.; list files that are text, ascii, unicode etc etc

file /home/bandit4/inhere/\*

Find a readable file, that is not executable, and has a certain size (within same directory)

find -readable -size 1033c ! -executable


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://0xdecaf2bad.gitbook.io/red-team-notes/08-commands/linux.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.
