Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••••••••••••••••••
Intelligence View
⚡ tsecurity.de Intelligence

Day 14/ 30 Days of Linux Mastery: Find Command

Table of Contents Introduction What is the find Command? Core find Commands Real-World Scenario: find Command Conclusion Let's Connect Introduction Welcome…

Beitrag
0
Seite
0
↗ Quelle (dev.to)
Social ReaktionenReagiere als Erste:r — dein Feedback zählt!




Table of Contents




  • Introduction

  • What is the find Command?

  • Core find Commands

  • Real-World Scenario: find Command

  • Conclusion

  • Let's Connect











Introduction



Welcome back to Day 14 of this practical Linux challenge! Today, we are diving into one of the most useful Linux commands: find.



This command helps you search for files and folders fast, flexible, and powerful.











What is the find Command?



The find command is used to look for files and directories in your system based on conditions like:




  • Name

  • Size

  • File type

  • Date modified

  • User ownership

  • And more...



This is especially useful in production environments where systems grow large and messy fast.











Core find Commands



Basic Syntax for find is




find [path] [condition] [action]

# Example

find /home -name "file.txt" - # This searches for file.txt inside the /home directory.







More commonly used find commands are listed in the table below.









































find command
Meaning
-name Search by file name
-type File type: f for file, d for directory
-mtime Files modified X days ago (+, -, or exact number)
-size Search by file size (e.g., +5M for greater than 5MB)
-user Owned by a specific user
-exec Run command on found files
-delete Deletes the files (use with caution!)










Real-World Scenario: find Command




  • Find a File by Name




bash
find / -name "*.conf" - # Searches for a file that has .conf inside /







f1 description




  • Find Files Modified in the Last 3 Days




bash

find /root -type f -mtime -3 - # Useful for checking recent file changes or uploads.

find /root -type d -mtime -3 - # use d for directories or folders







f2 description



f3 description







  • Find Large Files (More Than 100MB)




find / -type f -size +100M    - # Great for finding what’s eating up disk space.

find / -type f -size -20k - # check files less than 20kb







f4 description




  • Find Files and Delete Them




touch /tmp/files.tmp /tmp/newfilesv{1..5}.tmp   # let's create new files in the /tmp folder

ls /tmp - # to verify the created files

find /tmp -type f -name "*.tmp" - # find the files with .tmp in /tmp

find /tmp -type f -name "*.tmp" -delete - # Deletes all .tmp files in /tmp






f5 description



f6 description



f8 description






Let's say your/var/log directory is filling up fast, and you need to:




  • Find all .log files older than 7 days.


  • Delete them to save space.


  • We will first check what you will delete.





find /var/log -name "*.log" -mtime +7







  • Now you are sure of what to delete, you can delete!




find /var/log -name "*.log" -mtime +7 -delete






We have saved disk space! Great.











Conclusion



You can use man find to explore more options on your RHEL system. You will be surprised how much power this one command holds.



You can also use some wildcards like:




  • * means - Any number of characters

  • ? means - A single character

  • [a-z] means - Any letter a to z




If you use file*, you are telling Linux: “Find anything that starts with ‘file’.”




If this is helpful to you, feel free to bookmark, comment, like and follow me for Day 15!











Let's Connect!



If you want to connect or share your journey, feel free to reach out on LinkedIn.

I am always happy to learn and build with others in the tech space.



#30DaysLinuxChallenge #Redhat#RHCSA #RHCE #CloudWhistler #Linux #Rhel #Ansible #Vim #CloudComputing #DevOps #LinuxAutomation #IaC #SysAdmin#CloudEngineer

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Day 14/ 30 Days of Linux Mastery: Find Command

Thematisch verwandte Begriffe: Days, Linux, Mastery, Find · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag