Finding Files

Learn how to find files.

There is only a few things to cover in this module.

Commands :

Ensure to updatedb time to time. Starting with the whereis :

  • whereis <command> -> this command is used to locate the binary, source, and manual page files, example whereis cd <-> cd: /usr/bin/cd /usr/share/man/man1/cd.1.gz /usr/share/man/man1p/cd.1p.gz

  • locate <filename> -> used to find files by name

  • which <command> -> shows the full path of (shell) commands.

  • find -> search for files in a directory hierarchy

Practice Time :

Find all the conf files in the kernel by user chxmxii with size under 10Ko having the SUID and SGID perm and copy them to a directory called confiles.

Answer

mkdir /confiles
find / *.conf -type f -user chxmxii -size -10K -perm 6000 -exec cp {} /confiles ;\ 2>/dev/null  

Last updated

Was this helpful?