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

  • 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
  • How to Intercept Secret IoT Camera Traffic
  • Build Ultra-Fast and Tiny Desktop Apps with Electrobun: A Beginner’s Guide
  • The Ultimate 2026 Coding Roadmap: How to Master Software Engineering with AI Agents
  • How to Master Cloud Infrastructure with Ansible and Terraform
  • How to Fix VirtualBox Stuck on Saving State: A Complete Guide
  • How to Run Windows Apps on Linux: A Complete Guide to WinBoat, WINE, and Beyond
  • Build Your Own AI Development Team: Deploying OpenClaw and Claude Code on a VPS!
  • How to Measure Real Success in the Age of AI: A Guide to Software Metrics That Actually Matter
  • Kubernetes Traffic Tutorial: How to Create Pod-Level Firewalls (Network Policies)
  • This Is Discord Malware: Soylamos; How to Detect & Prevent it
  • How Stripe Ships 1,300 AI-Written Pull Requests Every Week with ‘Minions’
  • How to Disable Drag Tray in Windows 11: Simple Steps for Beginners
  • About Critical Microsoft 365 Copilot Security Bug: Risks and Data Protection Steps
  • Is the $600 MacBook Neo Actually Any Good? A Detailed Deep-Dive for Student!
  • 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
  • Inilah Rincian Gaji Polri Lulusan Baru 2026, Cek Perbedaan Jalur Akpol, Bintara, dan Tamtama Sebelum Daftar!
  • Inilah 5 Channel YouTube Membosankan yang Diam-diam Menghasilkan Banyak Uang
  • Inilah Cara Pakai Google Maps Offline Biar Mudik Lebaran 2026 Nggak Nyasar Meski Tanpa Sinyal!
  • Inilah Alasan Mahkamah Agung Tolak Kasasi Google, Denda Rp202,5 Miliar Resmi Menanti Akibat Praktik Monopoli
  • Inilah Cara Daftar dan Syarat SPMB SMK Boarding Jawa Tengah 2026, Sekolah Gratis Sampai Lulus!
  • How to Vibe Coding a Game in 2026
  • Running NVIDIA’s Nemotron-3 Super 120B Model Locally with Ollama: A Complete Guide for Young Tech Enthusiasts
  • How to Track Objects and Blur Faces with Nero Motion Tracker AI
  • Introducing TadaTTS: A New Free Text to Speech Just Broke the Rule of TTS
  • How to Have OpenClaw Agent that Work for You 24/7/365?
  • 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