How do you find a file in Linux?

Answer

Use the find command. find /path -name "filename" searches by exact name. find /path -name "*.log" uses a wildcard. find / -type f -name "config.php" finds files (not dirs). find / -type d -name "logs" finds directories. find /home -user john finds files owned by john. find /tmp -mtime +7 finds files modified more than 7 days ago. locate filename is faster (uses a database updated by updatedb) but may not reflect recent changes. which command finds the path of an executable in your PATH.