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

  • How to Design a Services Like Google Ads
  • How to Fix 0x800ccc0b Outlook Error: Step-by-Step Guide for Beginners
  • How to Fix NVIDIA App Error on Windows 11: Simple Guide
  • How to Fix Excel Formula Errors: Quick Fixes for #NAME
  • How to Clear Copilot Memory in Windows 11 Step by Step
  • How to Show Battery Percentage on Windows 11
  • How to Fix VMSp Service Failed to Start on Windows 10/11
  • How to Fix Taskbar Icon Order in Windows 11/10
  • How to Disable Personalized Ads in Copilot on Windows 11
  • What is the Microsoft Teams Error “We Couldn’t Connect the Call” Error?
  • Why Does the VirtualBox System Service Terminate Unexpectedly? Here is the Full Definition
  • Why is Your Laptop Touchpad Overheating? Here are the Causes and Fixes
  • How to Disable All AI Features in Chrome Using Windows 11 Registry
  • How to Avoid Problematic Windows Updates: A Guide to System Stability
  • What is Microsoft Visual C++ Redistributable and How to Fix Common Errors?
  • What is the 99% Deletion Bug? Understanding and Fixing Windows 11 File Errors
  • How to Add a Password to WhatsApp for Extra Security
  • How to Recover Lost Windows Passwords with a Decryptor Tool
  • How to Fix Python Not Working in VS Code Terminal: A Troubleshooting Guide
  • Game File Verification Stuck at 0% or 99%: What is it and How to Fix the Progress Bar?
  • Why Does PowerPoint Underline Hyperlinks? Here is How to Remove Them
  • AI Bug Hunting with Semgrep
  • What is the Excel Power Query 0xc000026f Error?
  • How to Build Your Own Homelab AI Supercomputer 2026
  • How to Enable SSH in Oracle VirtualBox for Beginners
  • Inilah Cara Dapat Saldo Cool Lady Tanpa Undang Teman, Ternyata Begini Trik Rahasianya!
  • Inilah Cara Main Watermelon Merge Fun Biar Dapat Saldo DANA, Apakah Benaran Membayar?
  • Inilah Kenapa Stok Penarikan Free Reels Sering Habis dan Cara Mengatasinya Agar Saldo Cair!
  • Inilah Alasan Kenapa Telat Lapor SPT 2026 Nggak Bakal Kena Denda, Cek Aturan Lengkapnya!
  • Inilah Cara Mematikan Koreksi Otomatis di WhatsApp Agar Nggak Salah Ketik Lagi
  • How to Use Orbax Checkpointing with Keras and JAX for Robust Training
  • How to Automate Any PDF Form Using the Power of Manus AI
  • How to Training Your Own YOLO26 Object Detection Model!
  • How to Build a Full-Stack Mobile App in Minutes with YouWare AI
  • How to Create Consistent Characters and Cinematic AI Video Production with Seedance
  • 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