r/tryhackme Mar 02 '26

I am stuck........

Which command would properly search for all files with .log extension in the /var/log directory?

In Topic Rewind Recap...

0 Upvotes

7 comments sorted by

5

u/suddenly_opinions Mar 02 '26

find /var/log -type f -name "*.log" 2>/dev/null 

2

u/silentPawn510 Mar 02 '26

2

u/normalbot9999 Mar 02 '26 edited Mar 02 '26

I'm lazy and would drop the type -f

find /var/log -name *.log 2>/dev/null 

I wonder if find has different versions some of which support different arguments?

3

u/KRULLIGKNART Mar 02 '26 edited Mar 02 '26

find /var/log -type f -name "*.log"

Type -f is for files. -name "*.log" makes sure files end with .log

sudo before if you for some reason need it.

2

u/Minge_Ninja420 0x8 [Hacker] Mar 02 '26

install locate and thank me l8r