• Contact
  • About Me
  • Privacy Policy
  • Disclaimer
DefenceDev
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools
No Result
View All Result
DefenceDev
No Result
View All Result
ADVERTISEMENT
Home Linux Tutorials Commands

10+ Useful Linux find Command Examples You Should Know

neo by neo
September 12, 2025
in Commands, Linux Tutorials
0
10+ Useful Linux find Command Examples You Should Know

10+ Useful Linux find Command Examples You Should Know

0
SHARES
33
VIEWS
Share on FacebookShare on LinkedIn
Table of Contents
  • Useful Linux find Command Examples
  • find Command Examples
    • Finding All .log Files in the Home Directory
    • Finding All Empty Directories
    • Finding Files Modified in the Last 24 Hours
    • Finding Files Larger Than 500 MB and Deleting Them
    • Finding Files Owned by a Specific User and Changing Their Permissions
  • Advanced find Command Examples
    • Finding Files Accessed in the Last 7 Days
    • Finding Files with Specific Permissions (e.g., 777)
    • Finding and Archiving Files Modified in the Last 3 Days
    • Finding Symbolic Links in a Directory
    • Excluding a Directory from Search
  • Tips to Use find Effectively
  • Recommended Reading

Useful Linux find Command Examples

The find command in Ubuntu is a versatile tool for searching files and directories based on various criteria such as name, size, type, and modification time. It allows users to perform complex queries, execute actions on matched files, and integrate with other commands to streamline file management tasks.

find Command Examples

Finding All .log Files in the Home Directory

This command searches recursively in the home directory for files ending with .log.

find ~/ -name "*.log"

Finding All Empty Directories

This finds all empty directories under a given path.

find /path/to/search -type d -empty

Finding Files Modified in the Last 24 Hours

Use this to locate files modified in the last 24 hours.

find /path/to/search -mtime -1

Finding Files Larger Than 500 MB and Deleting Them

This finds files larger than 500 MB and removes them.

⚠️ Caution: Use this command carefully; it will permanently delete files.

find /path/to/search -size +500M -exec rm {} \;

Finding Files Owned by a Specific User and Changing Their Permissions

This locates files owned by a user and sets their permissions to 644.

find /path/to/search -user username -exec chmod 644 {} \;

Advanced find Command Examples

Finding Files Accessed in the Last 7 Days

find /path/to/search -atime -7

This lists files accessed in the last 7 days.

Finding Files with Specific Permissions (e.g., 777)

find /path/to/search -perm 0777

Finds all files or directories with 777 permissions.

ADVERTISEMENT

Finding and Archiving Files Modified in the Last 3 Days

find /path/to/search -mtime -3 -type f -print | tar -czf recent-files.tar.gz -T -

This command archives all files modified in the last 3 days into a .tar.gz file.

ADVERTISEMENT

Finding Symbolic Links in a Directory

find /path/to/search -type l

Lists all symbolic (soft) links.

Excluding a Directory from Search

find /path/to/search -path /path/to/search/exclude-dir -prune -o -name "*.txt" -print

This excludes a specific directory from the search results while finding .txt files.

Tips to Use find Effectively

  • Combine with grep to filter content inside found files.
  • Use -exec to apply commands like mv, chmod, chown, rm, or custom scripts.
  • Use xargs for better performance with many files.
  • Use -iname for case-insensitive search.

Recommended Reading

If you found this guide helpful, you may also want to check out these related Linux solutions:

  • Find the Largest Files and Folders on Linux
    Learn how to identify and analyze large files or directories taking up disk space on your system.
  • List and Delete Log Data Older Than 30 Days
    A practical solution to automatically clean up old log files and manage disk usage effectively.

About The Author

neo

See author's posts

ADVERTISEMENT
Previous Post

Host a Website on Raspberry Pi – Real Benchmark Tests

Next Post

Automatic Windows Service Monitoring and Restart Script

neo

neo

Related Posts

Automating Linux Server Reboot with Ansible
Linux Tutorials

Automating Linux Server Reboot with Ansible

GitHub: How to Add a Script or a Folder to Your Repository
Linux Tutorials

GitHub: How to Add a Script or a Folder to Your Repository

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)
Linux Tutorials

My Ultimate Linux/Ubuntu Commands Cheat Sheet (2025)

Linux Networking: Display Open Ports and Listening Services
Networking

Linux Networking: Display Open Ports and Listening Services

List Installed Packages on Linux
Linux Tutorials

List Installed Linux Packages

Automating Linux Server Health Checks with a Bash Script
Linux Tutorials

Automating Linux Server Health Checks with a Bash Script

Next Post
Automatic Windows Service Monitoring and Restart Script

Automatic Windows Service Monitoring and Restart Script

Leave a Reply

Your email address will not be published. Required fields are marked *


Recommended

Self-Hosted Nextcloud Hub 10 on Ubuntu – My Top 5 Apps

Nextcloud: My Top 5 Must-Have Apps

Fortinet FortiGate: Routing Design Best Practices

Fortinet FortiGate: Routing Design Best Practices

Install Portainer on Ubuntu 24.04 Using Docker Compose

Install Portainer on Ubuntu 24.04 Using Docker Compose

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

View & Copy Image Metadata Online – Camera & GPS Info

View & Copy Image Metadata Online – Camera & GPS Info

Categories

  • Blog
  • Cloud
    • Private
  • Linux Tutorials
    • Bash Scripting Tutorials
    • Commands
    • Networking
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Solutions
    • Docker
  • Video Tutorials
    • MikroTik Videos
  • Web Tools
ADVERTISEMENT

DefenceDev Tutorials

defencedev Logo

Whether you’re just starting or looking to expand your skills, I hope you find useful information and engaging discussions here. Let me take you through my journey and the goals behind this space!

Follow Us

Recent News

Install Portainer on Ubuntu 24.04 Using Docker Compose

Install Portainer on Ubuntu 24.04 Using Docker Compose

FortiGate Country Address Object Generator – Block or Allow Access by Country

FortiGate Country Address Object Generator – Block or Allow Access by Country

  • Site Map
  • Privacy Policy
  • Facebook Page
  • Disclaimer
  • Contact
  • About Me

© 2025 defencedev.com - All rights reserved.

No Result
View All Result
  • Home
  • Blog
  • Linux Tutorials
    • Bash Scripting Lessons
    • Commands
    • Networking
    • Bash Scripts
  • Solutions
    • Docker
  • Network Tutorials
    • FortiGate
    • MikroTik
  • Projects
    • AdGuard
    • Immich
    • Nextcloud
    • WordPress
  • Cloud
  • Video Tutorials
    • YouTube Channel
    • MikroTik Videos
  • Web Tools

© 2025 defencedev.com - All rights reserved.