• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
Source Digit

Source Digit

Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • How To
  • Ubuntu
  • Instagram
  • Blogging
  • Android
  • WordPress
  • +More
    • Cloud Computing
    • Gadgets
    • Social Media
    • Technology
  • Write for Us
Home / How To / How To Find A File In Linux In All Directories Recursively

How To Find A File In Linux In All Directories Recursively

By Sourabh / March 21, 2022 Category: How To, Ubuntu

How to find file in subdirectories Linux – find file recursively in Linux. Here is the Unix command to find a file in a directory and subdirectory.

What is Recursive Listing of a Directory

Recursive means if a directory has subdirectories and files, the command will be executed and applied on those files too (recursively).

The simplest way to see the list of files and sub-directories in any specific directory is using tree command.

Tree is a recursive directory listing program that produces a depth indented listing of files. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and/or directories found in the given directories each in turn. Upon completion of listing all files/directories found, tree returns the total number of files and/or directories listed.

tree comamnd

Here is an easier way to perform the recursive search with the tree command:

tree -a

When -a is used with the tree command, all files are printed. By default tree does not print hidden files (those beginning with a dot .’). Also, in no event does tree print the file system constructs.’ (current directory) and `..’ (previous directory).

Combine ‘find’ and ‘grep’

You can also use a combination of two commands in Linux – find and grep commands to recursively search subdirectories for files that match a grep pattern (provided with the argument):

find . -type f -exec grep -l 'directory_name' {} \;

This command makes the task very simple. It searches all files in all subdirectories of the current directory’, and print the filenames. It is a great set of commands to recursively searching files in all subdirectories.

Other Commands to Find Files Recursively

There are many other commands to find files recursively. Linux Ubuntu users can use any one of the following commands:

  1. ls -R : Use the ls command to get recursive directory listing on Linux systems
  2. find /dir/ -print : Use the find command to see recursive directory listing in Unix systems
  3. du -a . : Use the du command to view recursive directory listing on Unix systems

Primary Sidebar

Latest Posts

Ubuntu 25.04 ‘Plucky Puffin’ Is Available To Download

How to Login as Root User in Linux Terminal

Install Firefox In Ubuntu Terminal Command Line

How To Check Kernel Installed Date In Linux Ubuntu

How To List All Kernel Modules That Are Loaded In Ubuntu

Enable Ubuntu Auto Login Without Password

Download Ubuntu 25.04 Official Default Wallpapers

How To Fix Initramfs Error In Ubuntu Command Line

How To Check All Available Kernel Version In Linux Ubuntu

3 Best Artificial Intelligence Domain Name Generators

© 2025 Source Digit • Linux, Ubuntu Tutorials & News, Technology, Gadgets & Gizmos

  • Home
  • About
  • Privacy Policy
  • Terms & Conditions
  • Contact Us
  • Sitemap