---
title: "How to Find Files with Dozens of Criteria with the Bash Find Command"
description: "Learn how to find files in just about any possible using the Bash find command in this helpful step-by-step tutorial."
canonical: "https://adamtheautomator.com/bash-find/"
---

# How to Find Files with Dozens of Criteria with the Bash Find Command

> Learn how to find files in just about any possible using the Bash find command in this helpful step-by-step tutorial.

Source: https://adamtheautomator.com/bash-find/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![How to Find Files with Dozens of Criteria with the Bash Find Command](https://adamtheautomator.com/wp-content/uploads/2021/07/How-to-Find-Files-with-Dozens-of-Criteria-with-the-Bash-Find-Command.jpg)

# How to Find Files with Dozens of Criteria with the Bash Find Command

[![](https://secure.gravatar.com/avatar/7784b2856d14deb6ab96179dba6277721730e10e6979cf84e5699ddf4bb309d7?s=192&d=mm&r=g)Adedoyin Adeyemi](https://adamtheautomator.com/author/adedoyin-adeyemi/)27 July 202114 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Bash](/tag/bash/)[Command Line](/tag/command-line/)[Linux](/tag/linux/)

Table of Contents

*   [Prerequisites](#h-prerequisites)
*   [The Bash find Command 101](#h-the-bash-find-command-101)
*   [Finding Files with Tests (aka Filters)](#h-finding-files-with-tests-aka-filters)
*   [Finding Files by File or Directory Name](#h-finding-files-by-file-or-directory-name)
*   [Finding Files and Directories by File Type](#h-finding-files-and-directories-by-file-type)
*   [Finding Files and Directories with Tests and Operators](#h-finding-files-and-directories-with-tests-and-operators)
*   [Combining Two Conditions with the -and Operator](#h-combining-two-conditions-with-the-and-operator)
*   [Combining Two Conditions with the -or Operator](#h-combining-two-conditions-with-the-or-operator)
*   [Filtering out Files with the -not Operator](#h-filtering-out-files-with-the-not-operator)
*   [Finding Files by Grouping Expressions](#h-finding-files-by-grouping-expressions)
*   [Grouping Expressions with Parentheses](#h-grouping-expressions-with-parentheses)
*   [Searching for Files from the Parent Directory](#h-searching-for-files-from-the-parent-directory)
*   [Finding Files and Directories by Permission](#h-finding-files-and-directories-by-permission)
*   [Finding Files via Symbolic Mode](#h-finding-files-via-symbolic-mode)
*   [Finding Files and Directories via Absolute Mode](#h-finding-files-and-directories-via-absolute-mode)
*   [Modify Search Result Output with the -print Parameter](#h-modify-search-result-output-with-the-print-parameter)
*   [Finding and Printing Files Names Without White Spaces](#h-finding-and-printing-files-names-without-white-spaces)
*   [Finding and Printing File with Properties via Print Formatting](#h-finding-and-printing-file-with-properties-via-print-formatting)
*   [Limiting the Depth of Finding Files](#h-limiting-the-depth-of-finding-files)
*   [Finding Files Limited to Working Directory with -prune Option](#h-finding-files-limited-to-working-directory-with-prune-option)
*   [Finding Files and Directories via Last Time Access](#h-finding-files-and-directories-via-last-time-access)
*   [Finding Files via File’s Last Day Access](#h-finding-files-via-file-s-last-day-access)
*   [Finding Files via File’s Last Minute Access](#h-finding-files-via-file-s-last-minute-access)
*   [Finding Files and Directories via Last Time Change](#h-finding-files-and-directories-via-last-time-change)
*   [Executing a Command After Finding File or Directory](#h-executing-a-command-after-finding-file-or-directory)
*   [Removing Files and Directories with the -delete Action](#h-removing-files-and-directories-with-the-delete-action)
*   [Conclusion](#h-conclusion)

Have you ever been stuck searching for a file and could not remember where you saved it, let alone the filename itself? On Linux, the Bash `find` command will help you scour your system to find that file.

Not a reader? Watch this related video tutorial!

b>_Not seeing the video? Make sure your ad blocker is disabled._

The Bash `find` command in Linux offers many ways to search for files and directories. In this tutorial, you’ll learn how a file’s last-time access, permissions, and more can help find files and directories with the Bash `find` command. Let’s get started!

## Prerequisites

If you’d like to follow along with the various demos in this tutorial, be sure you have the following:

*   A Linux PC – This tutorial uses Ubuntu 20.04, but any Linux distribution should work.
*   The `find` utility – The Bash find utility should already be on all Linux distributions. This tutorial uses v4.7.0.

## The Bash `find` Command 101

Finding a file requires some criteria; a part of the file name, a file type, permissions on the file, etc. The `find` command allows you to define those criteria to narrow down the exact file(s) you’d like to find. The find command finds or searches also for [symbolic links (symlink)](https://www.freecodecamp.org/news/symlink-tutorial-in-linux-how-to-create-and-remove-a-symbolic-link/#:~:text=A%20symlink%20\(also%20called%20a,opposed%20to%20%22hard%20links.%22). A symbolic link is a Linux shortcut file that points to another file or a folder on your computer. Let’s first cover the most basic way to use the Bash `find` command.

Perhaps you’re in your home directory, looking for a directory named _snap_ and all files and subdirectories under it. In that case, run the `find` command, followed by the directory’s name (`"snap"`), and that’s it!

Since there are no other command line arguments below, you can see the list of files and directories found recursively inside the _snap_ directory.

```bash
find "snap"
```

![Finding Directory (snap) and Listing its Contents](https://adamtheautomator.com/wp-content/uploads/2021/07/1-1.png)

Finding Directory (snap) and Listing its Contents

> _If you don’t specify the `name` parameter, `find` will assume the first argument should be for the `name` parameter, e.g., `find "snap"` is the same as `find -name "snap`.”_

## Finding Files with Tests (aka Filters)

You have seen the most basic form of the `find` command and how it works. But perhaps you want to narrow down the search a bit to define more specific criteria. If so, you’ll need to apply [tests](https://ss64.com/bash/find_tests.html). Tests are criteria you provide to the `find` command.

Tests tell the `find` command to filter the output based on many different criteria.

### Finding Files by File or Directory Name

Perhaps you only remember how the name of the file starts, maybe in a case-insensitive manner. In that case, you can use a wildcard to help narrow down the results.

```bash
# Find files and directories with names starting with 'snap'
find -name "snap*"

# Find files and directories with names starting with 'snap'
# in case insensitive manner (For example:'Snap', 'snap', 'SNaP', etc.)
find -iname "snap*"
```

![Finding Files and Directories via -name Test](https://adamtheautomator.com/wp-content/uploads/2021/07/2-1.png)

Finding Files and Directories via `-name` Test

### Finding Files and Directories by File Type

Like the `-name` test, the `-type` test is another efficient way of finding files and directories. The `-type` test lets you filter the result of the `find` command by either files or directories.

```bash
# Find a file named 'snap'
find "snap" -type f
# Find a directory named 'snap'
find "snap" -type d
```

![Finding Either Files or Directories with the -type Test](https://adamtheautomator.com/wp-content/uploads/2021/07/3-2.png)

Finding Either Files or Directories with the `-type` Test

To further narrow down the file search, combine the `-name` and `-type` tests by running the command below.

The `find` command below looks for directories only (`-type d`) with names (`-name`) that start with `snap`.

```bash
find -name "snap*" -type d
```

![Finding a Directory with Name that Starts with 'snap'](https://adamtheautomator.com/wp-content/uploads/2021/07/not.png)

Finding a Directory with Name that Starts with ‘snap’

## Finding Files and Directories with Tests and Operators

Now that you’ve learned the basics of the `find` command combined with tests, it’s time to take the file-searching up a notch. Perhaps you need to find files or directories that match more than one condition, such as the name and file type. In that case, you need to combine conditions.

When you need to add more than one condition to find files, you can combine conditions with operators. Operators are elements that allow you to combine conditions to form more complex tests/filters.

### Combining Two Conditions with the `-and` Operator

Perhaps you need to find some files or directories that match a specific name _and_ type. To do that, you can use the `-and` operator. The `-and` operator allows you to combines two or more expressions and outputs the result only if the find command returns a true value. Expressions are the representations of certain conditions, like when filtering files by name (`-name "snap"`).

To demonstrate how the `-and` operator combines two conditions, run each following commands.

```bash
# Find files only (-type f) and (-and) ensure the names (-name) start with snap
# in the current directory and subdirectories.
find -name "snap*" -and -type f

# Find directories only (-type d) and (-and) ensure the names (-name) start with snap
# in the current directory and subdirectories.
find -name "snap*" -and -type d

# Find files only (-type f) and (-and) ensure the names (-name) start with snap
find -name "snap" -and -type f

# Find directories only (-type d) and (-and) ensure the names (-name) start with snap
find -name "snap" -and -type d
```

![Finding Files and Directories with -and Operator](https://adamtheautomator.com/wp-content/uploads/2021/07/4.png)

Finding Files and Directories with `-and` Operator

### Combining Two Conditions with the `-or` Operator

Like the `-and` operator, the `-or` operator (`-o`) also combines two separate expressions. The difference is that the `find` command will output results even if only one expression is true.

Below is a basic syntax of how to combine two conditions with the `-or` operator. The `find` command outputs the result even if only one, either expr1 or expr2, returns a true value.

```bash
find <expr1> -or <expr2>
```

Perhaps you’d like to find a file name using the `-name` parameter of a specific type using the `-type` parameter. If so, run the `find` command below to look for files (`-type f`) with names (`-name`) that start with `snap` `-or` `chart`.

```bash
find -name "snap*" -type f -or -name "chart*"
```

![Finding Files with Names Starting Either with snap or chart](https://adamtheautomator.com/wp-content/uploads/2021/07/or.png)

Finding Files with Names Starting Either with snap or chart

### Filtering out Files with the `-not` Operator

Unlike the first two operators where you filter the contents you’re looking for, the `-not` operator (`!`) is the contrary. The `-not` operator excludes files and directories that you don’t want to see in the search result.

Maybe you want to find files only with names that _don’t_ start with a specific name. In that case, run the following command. Notice the `find` command below looks for files only (`-type f`), with names (`-name`) that _don’t_ start with `snap`.

```bash
find -not -name "snap*" -type f
```

![Excluding Files and Directories From Search Result with -not Operator](https://adamtheautomator.com/wp-content/uploads/2021/07/not-1.png)

Excluding Files and Directories From Search Result with `-not` Operator

## Finding Files by Grouping Expressions

By now, you’ve learned how to use tests and operators to filter the `find` command’s result. But what if your target result is a bit complex? If so, you need to look into grouping expressions. The Bash `find` command allows you to group expressions which means to define two or more conditions “sets.”

### Grouping Expressions with Parentheses

Let’s say you need to find files or directories with different names. You’ll soon find the task impossible by using the `find` command basics, as covered earlier. As a solution, you’ll need to use parentheses to combine the expressions to form a single complex expression.

In this example below, the `find` command will either look for files (`-type f`) with `.html` extension or directories (`-type d`) with names that start with `chart`.

> _Both open and close parentheses are escaped with a backslash (`\`) to allow the terminal to read the parentheses literally. The escape character tells the `find` command to treat the character literally._

```bash
find \( -name "*.html" -type f \) -or \( -name "chart*" -type d \)
```

![Finding Files by Grouping Expressions with Parenthesis](https://adamtheautomator.com/wp-content/uploads/2021/07/group.png)

Finding Files by Grouping Expressions with Parenthesis

> _Rather than using parentheses, you can also use commas to group expressions like `find -name "snap*" -type d -delete, -name "chart*" -print`. Grouping expressions by commas is basically a running series of tasks in a single command._

## Searching for Files from the Parent Directory

In all of the previous examples, the Bash `find` command found files only from the current working directory and all subdirectories. But maybe you need to start your search at the parent directory instead. If so, give the `-depth` option a shot. The `-depth` parameter lists files and directories in depth-first order, as shown below.

The `find` command below lists the contents from the parent directory first and down to the working directory (`snap`).

```bash
find "snap" -depth
```

![Finding Files from Parent Directory to Working Directory](https://adamtheautomator.com/wp-content/uploads/2021/07/snap_chart.png)

Finding Files from Parent Directory to Working Directory

## Finding Files and Directories by Permission

Instead of finding files filtered by name and type, the find command also lets you find files and directories filtered by permission. In Linux, every file and folder has specified permissions for owners, group owners, and other users. The `find` command lets you take advantage of those permissions to filter the search result for files and directories with the `-perm` option.

Related:[A Windows Guy in a Linux World: Users and File Permission](https://adamtheautomator.com/linux-file-permissions/#Numeric_Notation_for_File_Permissions)

> _Before you try to find files and directories with the `-perm` option, you’ll need to familiarize yourself with reading [permissions](https://www.tutorialspoint.com/unix/unix-file-permission.htm). Permissions indicate who has access and can modify certain files and directories._

### Finding Files via Symbolic Mode

Now that you understand the concept of file permissions try to find files via symbolic mode. The symbolic mode uses a combination of letters and symbols to represent file permissions.

To demonstrate how to find files via symbolic mode, run each of the following commands.

```bash
# Find only files (-type f) in the working directory (.) 
# with read, write and execute permissions for user, group and others in the current
find . -perm u=rwx,g=rwx,o=rwx -type f

# Find files (-type f) in the working directory (.) 
# with any of the read, write and execute permissions (not the exact)
# for user, group and others in the current
find . -perm -u=rwx,g=rwx,o=rwx -type f

# Find files (including hidden files) where either of the user, group or others 
# have read, write and execute access to files in the working directory (.)
find . -perm /u=rwx,g=rwx,o=rwx -type f
```

![how to find files via symbolic mode](https://adamtheautomator.com/wp-content/uploads/2021/07/Screenshot_from_2021-07-21_08-47-19-1.png)

how to find files via symbolic mode

### Finding Files and Directories via Absolute Mode

If you don’t prefer to find files via symbolic mode, then [absolute mode](https://docs.oracle.com/cd/E19455-01/805-7229/6j6q8svd8/) may pique your interest. Absolute mode defines permissions in octal numeric representation vs. using letters.

Below you can see that the symbolic mode **\-rwxrwxrwx** is equivalent to the absolute mode **777**.

![Absolute Mode](https://adamtheautomator.com/wp-content/uploads/2021/07/absolute.png)

Absolute Mode

Let’s say you only want to find files and directories with read-only permission for user, group and, others. If so, run each of the commands below to see the results you’ll get when finding files and directories via absolute mode.

```bash
# Find files and directories only with read-only permission 
# for user, group and others in the working directory (.)
find . -perm 444

# Find files and directories only that have least the read-only permission 
# for user, group and others in the working directory (.)
find . -perm -444

# Find files and directories only (including hidden files and directories) 
# that have least the read-only permission 
# for user, group and others in the working directory (.)
find . -perm /444
```

![Finding Files via Absolute Mode](https://adamtheautomator.com/wp-content/uploads/2021/07/permi.png)

Finding Files via Absolute Mode

## Modify Search Result Output with the `-print` Parameter

Instead of just displaying file paths in the search result, perhaps you want to see their properties as well. Using the `-print` action, you can modify the output the `find` command produces.

The `-print` parameter is the default behavior when you run the `find` command where it prints out the search result of files, each on a new line. So running either of the commands below to `find` files and directories named `snap`, you’ll get the same result.

```bash
find -name "snap" -print
find -name "snap"
```

![Printing output of results the find command produces with the -print action](https://adamtheautomator.com/wp-content/uploads/2021/07/Screenshot_from_2021-07-01_16-24-32.png)

Printing output of results the `find` command produces with the `-print` action

### Finding and Printing Files Names Without White Spaces

Unlike the default `-print` parameter, the `-print0` option lets you clear white spaces or newline characters in a search result returned by the `find` command. Especially when you’re passing the result to another command like `grep` to search for patterns.

The command below lets you find and output a directory without white spaces or newline characters.

```bash
# Find a file or directory named 'snap', print the result
# removing white spaces and newline characters
find -name "snap" -print0
```

![Printing Result in a Single Line](https://adamtheautomator.com/wp-content/uploads/2021/07/print0.png)

Printing Result in a Single Line

### Finding and Printing File with Properties via Print Formatting

To change up the format of the output, the `find` command also has a `-printf` parameter. This parameter allows you to create directives or “formatters” that define how the search result will look.

Perhaps you need to find files along with their properties like the last time they were accessed. If so, run the following commands.

```bash
# Find files only with names starting with 'snap', then print each file 
# along with their last-time access properties, full path and filename
# each on a new line
find -name "snap*" -printf "%a %p \n"

# Find files with .html or .json extension 
# then print each file owner's username, group name, full path and filename
# each on a new line
find \( -name "*.html" -type f \) -or -name "*.json" -printf "%u %g %p \n"
```

![Finding and Printing Files Properties via Directives](https://adamtheautomator.com/wp-content/uploads/2021/07/printf-1.png)

Finding and Printing Files Properties via Directives

Below is a list of directives available to work side by side with the `-printf` action:

*   `%a` – Returns the last time a file was accessed.
*   `%b` – Returns the amount of disk space used for a file in 512-byte blocks.
*   `%d` – Returns a file’s depth in the directory tree.
*   `%g` – Returns a file’s group name or numeric group ID if the group has no name.
*   `%k` – Returns the amount of disk space used for a file in 1K blocks.
*   `%m` – Returns permission bits of a file (in octal).
*   `%p` – Returns a file’s exact filename.
*   `%s` – Returns a file’s size in bytes.
*   `%t` – Returns a file’s last modification time in the format returned by the `-ctime` option.
*   `%u` – Returns a file owner’s user name or numeric user ID if the user has no name.

## Limiting the Depth of Finding Files

Perhaps you wish to narrow down further and limit the search in directories; you’ll need to use the `-maxdepth` option with the `find` command, as shown below.

The `-maxdepth` parameter tells the `find` command to limit the search scope to only a certain number of subdirectories down the directory tree.

```bash
# Find files and directories one step down from the working directory
find . -maxdepth 1 -name "chart*"

# Find files and directories two steps down from the ~/chart directory
find ~/chart -maxdepth 2 -name "chart"
```

![Finding Files Limited to the Current and Subdirectory](https://adamtheautomator.com/wp-content/uploads/2021/07/maxdepth.png)

Finding Files Limited to the Current and Subdirectory

## Finding Files Limited to Working Directory with `-prune` Option

If you need to limit a search to only the current working directory and not recurse into any subdirectories, check out the `-prune` parameter.

In the command below, you’ll `find` files and directories which names (`-name`) do not start with `snap` and is limited (`-prune`) to the working directory (`.`).

> _To get search results for files and folders with names starting in `snap` instead, remove the `-or` operator and `-print action`, like this: `find . -name "snap*" -prune`_

```bash
find . -name "snap*" -prune -or -print
```

![Pruning Search Result of Files with Names Starting in 'snap'](https://adamtheautomator.com/wp-content/uploads/2021/07/prune.png)

Pruning Search Result of Files with Names Starting in ‘snap’

## Finding Files and Directories via Last Time Access

Pruning particular files surely narrow down the search result. But what if the only thing you remember about the file you’re looking for is the last time you accessed that file? Well, the good news is that the find command lets you search for files and directories via their last-time access. Let’s dive in!

### Finding Files via File’s Last Day Access

Let’s say you still remember the last day you accessed a file or directory, then the `-atime` option combined with the `find` command is all you need, as demonstrated below. If a file’s last time access does not fall under that value you specified, the `find` command returns a false value and skips that file.

```bash
# Find files and directories you last accessed between 2-3 days ago
find -atime 2

# Find files and directories you last accessed within the past 2 days
find -atime -2

# Find files and directories you last accessed within the past day
find -atime 0
```

![Finding Files Accessed within Two and Three Days Ago](https://adamtheautomator.com/wp-content/uploads/2021/07/atime_2.png)

Finding Files Accessed within Two and Three Days Ago

![Finding Files Accessed within the Past Two Days](https://adamtheautomator.com/wp-content/uploads/2021/07/atime_-2.png)

Finding Files Accessed within the Past Two Days

![Finding Files Accessed within the Past Day](https://adamtheautomator.com/wp-content/uploads/2021/07/atime.png)

Finding Files Accessed within the Past Day

> _Perhaps you also want to see the last time access of a file or directory, then add the `-printf` action with directives. The command line below lets you `find` files accessed within the past day (`-atime 0`). Then the `-printf` action outputs the last time access (`%a`) of files or directories and the filenames (`%p`), each on a new line (`\n`), as shown below._

```bash
find -atime 2 -printf "%a %p \n"
```

![Finding Files via Last Time Access with Output](https://adamtheautomator.com/wp-content/uploads/2021/07/atime_printf.png)

Finding Files via Last Time Access with Output

### Finding Files via File’s Last Minute Access

Let’s say you need to find files based on the minute. Like the `-atime` option, the `-amin` functions the same. But instead, you’ll get search results for files filtered by their last time access based on the value you specified, as shown below.

```bash
# Find files and directories accessed within the past 40 minutes
# Not ideal most of the time as you will get result of tons of files and directories
find -amin 40

# Find directories accessed within the past 40 minutes
find -name "snap*" -type d -amin -40

# Find files accessed within the past 40 minutes
find -name "snap*" -type f -amin -40
```

![Finding Files Accessed in the Past 40 Minutes](https://adamtheautomator.com/wp-content/uploads/2021/07/Screenshot_from_2021-07-03_16-39-00.png)

Finding Files Accessed in the Past 40 Minutes

## Finding Files and Directories via Last Time Change

Finding files or directories via last time access may output tons of results, which would look confusing if the filenames are similar. So to further narrow down the search result, go with the `-ctime` option instead. The `-ctime` option filters the search result by the last time you made changes to the file or directory based on a specified value (within the past days).

Perhaps you want to find files that you modified last two days ago. If so, run the sample commands below.

```bash
# Find files and directories you modifed in the past two days
find -ctime -2

# Find files and directories with names starting with 'snap'
# which you modifed in the past two days
find -name "snap*" -ctime -2
```

![Finding Files and Directories Filtered by Last Time Change](https://adamtheautomator.com/wp-content/uploads/2021/07/ctime2.png)

Finding Files and Directories Filtered by Last Time Change

## Executing a Command After Finding File or Directory

The `find` command doesn’t just find files and directories; it can also execute commands right after displaying search results using the `-exec` parameter. This feature is great for times when you want to open a file in a text editor or remove a file or directory once found, for example.

> _Be sure to escape the semicolons (`;`) with a backslash (`\`) to prevent them from being interpreted._

```bash
# Find a file named 'snap.doc' then open the file in vi editor
find -name "snap.doc" -exec vi {} \;

# Find a file named 'snap.doc' then remove the file
find -name "snap.doc" -exec rm {} \;
```

## Removing Files and Directories with the `-delete` Action

The `find` command doesn’t just let you find files as you’ve learned so far. The `find` command also gives you an option to delete a [file](https://adamtheautomator.com/linux-directory-commands/#Removing_Directories_and_Files_in_Linux) automatically once it’s found. Perhaps you need to delete empty files or directories with a specific name or matching a specific pattern. Then the `find` command with the `-delete` action will definitely come in handy.

Related:[Your Guide to Managing Directories and Files in Linux \[Step by Step\]](https://adamtheautomator.com/linux-directory-commands/#Removing_Directories_and_Files_in_Linux)

To demonstrate deleting files and directories with the `-delete` action, create a directory and a file first. Below, the command lines let you create (`mkdir`) a directory named (`thanos`), then a file named `snap` inside the `thanos` directory.

```powershell
mkdir thanos
touch thanos/snap
```

The `-delete` action only deletes empty directories. So if you try to delete the `thanos` directory with the command line below, you’ll get a message saying **find: cannot delete ‘thanos’: Directory not empty.**

> _To delete a single file (`snap`), specify the `-type` test when you run the find command, like this: `find "snap" -type f -delete`_

```bash
# Find a directory named 'thanos', then delete the directory
# This command fails since the 'thanos' directory is not empty
find "thanos" -type d -delete

# Find a file named 'thanos.snap', then delete the file
find "thanos.snap" -type f -delete
```

![The ~/thanos directory cannot be deleted as it's not empty](https://adamtheautomator.com/wp-content/uploads/2021/07/thanos.png)

The _~/thanos_ directory cannot be deleted as it’s not empty

To delete the _~/thanos_ directory, apply the `-depth` option, as shown below. The `find` command will search for the `thanos` directory and recursively delete (`-delete`) the contents of the _~/thanos_ directory and delete the directory itself.

```powershell
find "thanos" -depth -delete
```

## Conclusion

This article aimed to teach you different ways on how the Bash find command lets you locate files, get file properties and even modify an output in certain formats. Before, finding a lost file was filled with obstacles along the way. But now, you can jump over the obstacles and go straight to the finish line—is that considered cheating?

Well, regardless of which method you tried to find your file, the experience is surely satisfying! So, which test, action or option did you find most interesting?

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Fbash-find%2F&text=How%20to%20Find%20Files%20with%20Dozens%20of%20Criteria%20with%20the%20Bash%20Find%20Command)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Fbash-find%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Fbash-find%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/04/Successfully-Save-The-Day-With-Bash-History-Commands.jpg)

### [Successfully Save The Day With Bash History Commands](/bash-history/)

Learn how to save the day and how you can save time re-running commands with Bash history commands in this tutorial!

![](https://adamtheautomator.com/wp-content/uploads/2026/02/featured_image-3.webp)

### [How to Ace the Modern Coding Interview as a SysAdmin](/ace-modern-coding-interview-sysadmin/)

Master coding interviews for sysadmin and DevOps roles with practical preparation strategies. Learn Python, Bash, and platform-specific techniques that translate your operational experience into interview success.

![](https://adamtheautomator.com/wp-content/uploads/2022/09/Practical-Linux-Unix-Tee-Commands-for-the-Linux-Admin.jpg)

### [Master Unix tee Commands for Real-World Linux Admin Tasks](/unix-tee/)

Simplify Linux output management and streamline your workflow with the “Unix tee” command. This tutorial guides you through its practical applications.

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
