Durgeshkt 4 months ago

find command CheatSheet

Basic Examples:

# Search for files or directories with the exact name "example.txt" in the current directory (and its subdirectories).

find . -name "example.txt"   

# Find all directories in the "/home" directory.     

find /home -type d 

# Search for files owned by the user "john" in the "/data" directory.           

find /data -user john  

# Find all files with the extension ".txt" in the current directory and download them using `curl`.          

find . -type f -name "*.txt" -exec curl -O {} \; 

Intermediate Examples:

# Extract specific content from a webpage using `curl` and `sed`.

curl https://example.com/page.html | sed -n 's/<p>\(.*\)<\/p>/\1/p'  

# Find all directories in the "/home" directory and count the number of files in each using `find` and `wc`.

find /home -type d -exec sh -c 'echo -n "{}: "; find "{}" -type f | wc -l' \; 

# Find all files modified in the last 7 days and perform an HTTP POST request with their content using `find`, `curl`, and `xargs`.

find . -type f -mtime -7 -print0 | xargs -0 -I{} curl -X POST -d @{} https://api.example.com/upload 

# Search for files with the extension ".log" in the "/var/logs" directory, compress them, and store in a backup folder using `find`, `curl`, and `tar`.

find /var/logs -type f -name "*.log" -exec tar czvf /backup/logs_backup.tar.gz {} \;  

Advanced Examples:

# Find all files in the current directory larger than 10MB and delete them using `find` and `rm`.

find . -type f -size +10M -exec rm {} \; 


0
247
A very comprehensive penetration testing memo: including tools, techniques and techniques [worth collecting]

A very comprehensive penetration testing memo: including tools, techni...

defaultuser.png
Durgeshkt
3 months ago
Curl Command Cheat Sheet for Penetration Testing

Curl Command Cheat Sheet for Penetration Testing

defaultuser.png
Durgeshkt
4 months ago
Understanding API Authentication: A Guide to Cookie-Based,jwt

Understanding API Authentication: A Guide to Cookie-Based,jwt

defaultuser.png
Godzilla
4 months ago
Make your python scripts accessible anywhere in your Linux terminal

Make your python scripts accessible anywhere in your Linux terminal

defaultuser.png
Durgeshkt
4 months ago
Cyber Security Useful Links

Cyber Security Useful Links

defaultuser.png
Durgeshkt
4 months ago