Skip to content
Tutorial emka
Menu
  • Home
  • Debian Linux
  • Ubuntu Linux
  • Red Hat Linux
Menu

Tutorial Cara Melakukan Exclude Satu Folder pada tool “Find” di Linux

Posted on October 25, 2024

Saat bekerja dengan perintah find di Linux, Anda mungkin perlu mencari file atau direktori sambil mengecualikan direktori tertentu dari hasil pencarian. Ini sangat berguna saat berhadapan dengan sistem file yang besar atau direktori dengan banyak subdirektori. Dengan menggunakan opsi -prune atau menggabungkan perintah find dengan operator ! (negasi), Anda dapat secara efisien mengecualikan direktori tertentu, merampingkan proses pencarian Anda.

find

-prune

-prunefind

Untuk menemukan semua file .txt di direktori , tetapi mengecualikan direktori Downloads:

      find /home/user -path "/home/user/Downloads" -prune -o -name "*.txt" -print
    

Untuk beberapa direktori:

      find /path/to/start -path "/first/path/to/exclude" -prune -o -path "/second/path/to/exclude" -prune -o -name "search_pattern" -print
    

-not

-not/home/user

      find /home/user -not -name "*.txt"
    

Menggabungkan dengan : Anda juga dapat menggabungkan dengan , meskipun ini mungkin membuat perintah lebih kompleks:

      find /path/to/start -not -path "/path/to/exclude" -prune
    

!

!-not

Penggunaan dasar:

      find /path/to/start ! -name "pattern_to_exclude"
    

Atau, untuk menghindari interpretasi shell:

      find /path/to/start ! -name "pattern_to_exclude"
    

    Temukan item yang mengecualikan file .txt dan .jpg:

          find /home/user ! -name "*.txt" ! -name "*.jpg"
        

      find /home/user -type d ! -name "temp"
    

    Urutan penting, terutama dengan . Letakkan tepat setelah kondisi yang ingin Anda kecualikan.

    Saat menggunakan karakter khusus atau directive di shell, pastikan mereka diinterpretasikan dengan benar, baik dengan menggunakan tanda kutip atau escaping.

    Untuk pencarian kompleks, gunakan tanda kurung untuk mengelompokkan kondisi. Ingatlah untuk mengescap mereka di shell: .

    Sebelum menggabungkan perintah dengan tindakan destruktif, uji kondisi Anda dengan untuk memastikan Anda menargetkan file yang benar.

    Singkatnya, perintah menyediakan opsi serbaguna, seperti , , dan , untuk menyempurnakan pencarian Anda dengan mengecualikan direktori atau pola tertentu. Memahami dan menggunakan opsi ini akan menghasilkan pencarian file dan direktori yang lebih efisien dan akurat di Linux.

Recent Posts

  • Build Your Own Mini Data Center: A Guide to Creating a Kubernetes Homelab
  • How Enterprise Stop Breaches with Automated Attack Surface Management
  • The Roadmap to Becoming a Professional Python Developer in the AI Era
  • Why Your High Linux Uptime is Actually a Security Risk: A Lesson for Future Sysadmins
  • Portainer at ProveIt Con 2026
  • How to Reset a Virtual Machine in VirtualBox: A Step-by-Step Guide
  • Notepad Security Risks: How Feature Creep Turned a Simple Tool Into a Potential Backdoor
  • How to Generate Battery Report in Windows 11: A Simple Guide
  • How to Setting Up a Pro-Level Security System with Reolink and Frigate NVR
  • How to Install DaVinci Resolve on Nobara Linux and Fix Video Compatibility Issues Like a Pro
  • How to Master GitHub’s New Power Tools: Copilot CLI, Dashboards, and More!
  • How to Create and Configure DNS Server on RHEL 10
  • How a Security Professional Bypassed a High-Security Building Using Just a Smartphone and a QR Code
  • A Step-by-Step Guide to Upgrading Uptime Kuma to Version 2.0
  •  How to Disable Bing Search in the Windows 11 Start Menu for Better Privacy
  • How to Transitioning from Engineer to Product Manager
  • How to Managing GitHub Pull Requests Directly from Your Terminal with Github-CLI
  • How to Building a Privacy-First Self-Hosted App Stack, 2026!
  • How to Remove Underlines from Links in Outlook
  •  How to Fix Microsoft 365 Deployment Tool Not Working: A Complete Troubleshooting Guide
  •  How to Fix Windows 11 ISO Download Blocked and Error Messages
  • How to Make Your Website Vibrate with Web Haptics
  • Measuring LLM Bullshit Benchmark
  • A Step-by-Step Guide to ZITADEL Identity Infrastructure
  • How NVIDIA G-SYNC Pulsar is Finally Fixing Motion Blur Forever
  • Inilah Cara Jadi Clipper Video Sukses Tanpa Perlu Tampil di Depan Kamera
  • Inilah Cara Upload NPWP dan Rekening di EMIS GTK Madrasah Terbaru, Jangan Sampai Tunjangan Terhambat!
  • Inilah Fakta di Balik Video Ukhti Sholat Mukena Pink Viral yang Bikin Geger Media Sosial
  • Belum Tahu? Inilah Langkah Pengisian Survei Digitalisasi Pembelajaran 2026 Biar Nggak Salah
  • Ini Kronologi Video Viral Ibu Tiri vs Anak Tiri Ladang Sawit Tiktok
  • How to Use SoulX FlashHead To Create The Best Talking Avatar for Free on Google Colab!
  • New Claude AI Memory: How to Seamlessly Sync ChatGPT to Anthropic in Minutes
  • Securing LLM with Agentverse (Secure and Scalable Inference)
  • ModernBERT: Why the Encoder-Only Model is Making a Massive Comeback in AI History
  • How to Build Your First AI App with Lovable AI Today!
  • Apa itu Spear-Phishing via npm? Ini Pengertian dan Cara Kerjanya yang Makin Licin
  • Apa Itu Predator Spyware? Ini Pengertian dan Kontroversi Penghapusan Sanksinya
  • Mengenal Apa itu TONESHELL: Backdoor Berbahaya dari Kelompok Mustang Panda
  • Siapa itu Kelompok Hacker Silver Fox?
  • Apa itu CVE-2025-52691 SmarterMail? Celah Keamanan Paling Berbahaya Tahun 2025
©2026 Tutorial emka | Design: Newspaperly WordPress Theme