"Where did that file go?" Two commands answer almost every such question: find searches by name, size and date, grep searches inside files. Both come with every Linux. The commands were tested on Ubuntu 26.04 LTS. Run them as root to search everywhere, or as your user to search your own files.


1. By Name

find /srv -name "*.jpg"
find /home -iname "notes*"

The first command lists all JPG files below /srv. -iname ignores upper and lower case, so notes* also finds NOTES.txt and Notes.pdf. Always put the name in quotes when it contains *.

To search the whole server, use find / -iname "notes*" 2>/dev/null; 2>/dev/null hides the messages about folders that cannot be read.

2. By Size

find /srv -type f -size +1G
find /srv -type f -size +100M -exec ls -lh {} \;

The first lists files larger than 1 GB; the second shows files over 100 MB with their sizes. Handy when the disk is full: What Fills the Disk and What Loads the Server.

3. By Date

find /srv -type f -mmin -60
find /srv -type f -mtime -7
find /srv -type f -mtime +30

Changed in the last 60 minutes, in the last 7 days, and more than 30 days ago. To delete old files on a schedule, see Delete Old Downloads Automatically on Your Linux Server.

4. By Content

grep -rl "invoice" /srv/documents
grep -rn "total" /srv/documents

-r searches all folders below, -l lists only the file names, -n shows the matching lines with their line numbers, for example /srv/documents/2025/notes.txt:1:invoice 2025 total 99. Add -i to ignore upper and lower case. This works for text files; inside PDF or Word files grep finds nothing useful.

Combine Them

find /srv -name "*.conf" -mtime -1

All .conf files changed since yesterday.


Related Guides

View all Linux guides

Was this answer helpful? 0 Users Found This Useful (0 Votes)