Sorting and Filtering
root@ip-172-31-81-31:/home/ubuntu/superset/superset# grep -n "EMAIL_REPORTS_CTA" config.py
1442:EMAIL_REPORTS_CTA = "Explore in Superset"
root@ip-172-31-81-31:/home/ubuntu/superset/superset# wc -l config.py
1883 config.py
escape + shift colun set number
find filter and sort
find with filter files dir
Got it 👍
You’re asking about find command options in Linux like -size +100M and -mtime.
Here’s a full cheat-sheet of the most useful find expressions (the "extra commands" you mean):
🔹 File Size
find . -size +100M # Files larger than 100 MB
find . -size -10k # Files smaller than 10 KB
find . -size 1G # Files exactly 1 GB🔹 File Modification / Access / Change Time
find . -mtime +7 # Modified more than 7 days ago
find . -mtime -1 # Modified within last 1 day
find . -mtime 0 # Modified today
find . -atime +30 # Accessed more than 30 days ago
find . -ctime -2 # Changed (metadata/permissions) within 2 days🔹 File Name / Pattern
find . -name "*.log" # Match exact name pattern
find . -iname "*.jpg" # Case-insensitive match
find . -regex ".*\.py$" # Regex match🔹 File Type
find . -type f # Files only
find . -type d # Directories only
find . -type l # Symlinks only🔹 Permissions / Ownership
find . -perm 644 # Exact permission 644
find . -perm -111 # Executable by anyone
find . -user root # Owned by root
find . -group devs # Owned by group 'devs'🔹 Deletion / Execution
find . -type f -name "*.tmp" -delete # Delete directly
find . -type f -name "*.sh" -exec chmod +x {} \; # Run command on each file
find . -type f -exec ls -lh {} \; # Long list details🔹 Depth & Pruning
find . -maxdepth 2 # Limit search depth
find / -mindepth 3 # Skip top 2 levels
find . -type d -name ".git" -prune -o -print # Ignore .git folder🔹 Combine Conditions
find . -type f -size +10M -mtime -7 # Files >10MB modified within 7 days
find . \( -name "*.log" -o -name "*.tmp" \) # .log OR .tmp files
find . -type f ! -perm 644 # Files not having 644 perms👉 These cover 90% of real-world find usage.
Do you want me to also give you a ready-made cheat sheet table (one-liner with description) that you can keep handy?
Last updated