Through an SSH session, you can search for files by name or look for text inside them. These read-only commands help locate application files and configuration without changing their contents.

Choose the search directory

Connect as an account authorised to read the files and change to the relevant directory. In the examples below, . means that directory and its subdirectories. Keep searches focused to avoid scanning unrelated accounts or large trees.

Find files and directories

Find a regular file with an exact, case-sensitive name:

find . -type f -name 'myfile.txt'

Use a quoted pattern for part of a name:

find . -type f -name 'myfile*'

Use -iname instead of -name for a case-insensitive match. To list directories:

find . -type d

To find regular files modified within the last two 24-hour periods:

find . -type f -mtime -2

Search text inside files

For a literal string in one file, with matching line numbers:

grep -nF -- 'database' configuration.php

For a recursive search that skips binary files and includes hidden directories:

grep -rInF -- 'database' .

To show only matching filenames:

grep -rIlF -- 'database' .

Matching configuration lines can contain passwords or other private data. Keep the results private and redact them before sharing.

Find an installed command

To locate a command available in your shell’s search path:

command -v perl

This checks command availability; it does not search the whole server for arbitrary files. Permission-denied messages indicate unreadable locations, not necessarily that the requested file is absent.