Shared server guidance · Question & answer

How do I find a server file by its name without searching the whole system?

find searches a directory tree and selects entries using tests such as name and file type. Start from the smallest useful directory, rather than /. Quoting wildcard patterns lets find apply them to the search tree instead of having your shell expand them first.

BeginnerLinux VPS and dedicated servers with GNU utilities
Go to the answer

Before you start

  • An authorised SSH session on the Linux server.

Instructions

1. Set the search boundary

Choose the known project or your home directory. The example searches only regular files within three directory levels, which keeps an interactive search predictable.

Remote Linux shell
find "$HOME/server-notes" -maxdepth 3 -type f -name "*.txt" -print

-type f selects regular files; -name matches the basename. No result is deleted or modified.

2. Adjust the match intentionally

Use a case-insensitive name search only when the application permits case variation. Linux filenames can distinguish uppercase and lowercase letters.

Remote Linux shell
find "$HOME/server-notes" -maxdepth 3 -type f -iname "report*.txt" -print

-iname matches case-insensitively. Remove the depth limit only when the expected file may be deeper and the wider scope is appropriate.

Check the result

  • Open the exact returned path and confirm its contents or metadata before using it in a subsequent action.

Troubleshooting

No matches are shown
Check the starting directory, filename case and depth limit. The file may be a symbolic link rather than a regular file.
The command says paths must precede expression
Keep the starting directory first and quote wildcard patterns so the shell cannot expand them unexpectedly.

Official references

Use the documentation for your installed version when a flag, service name or platform feature differs.