How to search on linux

By Yevgeniya Suminova on 2021-05-24

Introduction

This document explains how to search files or directories containing certain text in the name. Same as how to search files that contain specific strings inside theirs content.

Search for files and directories

Find directories:

find -type d -name "text_in_the_filename"

Find files:

find -type f -name "text_to_search"

Find files containing string:

find /the/path/where/to/search/ -type f -exec grep -l "text_to_search" {} \;

End of document

***

© 4z.com