sudo find / -name "nginx.conf" 2>/dev/null; use -iname to ignore upper and lower case and * as a wildcard, for example -name "*.log". To search for text inside files, run grep -rn "server_name" /etc/nginx: -r searches all subfolders and -n shows the line number of every match.
Before you start
- Connect with SSH.
- Searching the whole disk from
/can take a while and shows many “Permission denied” lines withoutsudo. Usesudo(root can leave it out), start in the most likely folder, and add2>/dev/nullto hide error messages.
How to find a file by name
Always put the name in quotes when it contains
*, so the shell doesn’t expand it first.
How to find files by size or date
-mtime -1 means “less than one day ago”; +7 means “more than seven days ago”. -mmin -30 works in minutes.
How to act on the files you find
Show details:How to find a file quickly with locate
locate searches a prebuilt index, so it answers instantly.
- Ubuntu / Debian
- AlmaLinux / Rocky
sudo updatedb.
How to search for text inside files with grep
To see a config file without comments and blank lines:
Search command output
Pipe any command intogrep:
How to check it worked
Create a test file and find it both ways:/home/alex/findme.txt; grep adds :1:hello from alex.
Frequently asked questions
How do I find which config file sets a value?
Search the config folder for the setting name:sudo grep -rn "upload_max_filesize" /etc/php. The last file loaded usually wins.
Is there a faster grep?
ripgrep (rg) skips binary and ignored files and is much faster on large trees. Install it with sudo apt install ripgrep on Ubuntu/Debian; on AlmaLinux/Rocky it is in EPEL.
How do I find which package owns a file?
Usedpkg -S /usr/sbin/nginx on Ubuntu/Debian and rpm -qf /usr/sbin/nginx on AlmaLinux/Rocky.
How do I find where a command is installed?
Runcommand -v nginx or which nginx. type -a nginx shows every match on your PATH.
Related guides
VPS and dedicated server guides
Every server guide in one place.
Essential Linux commands
The commands you use every day.
Check disk space
df and du explained.
Read logs with journalctl
Search the systemd journal.
Checked against the official GNU findutils manual and GNU grep manual on 4 November 2026; commands tested on Ubuntu 24.04 LTS. Commands can differ on other distributions or releases.
Need Extra Help?
If you encounter any issues, our support team is ready to assist:- Live Chat: Quick assistance via our website.
- Support Ticket: Open a Ticket
- Discord: Join our Community
- Email: support@freakhosting.com
Last Updated: November 2026