NeilSec: Security Learning Blog

Pentesting, infosec, hacking, learning.

  • Home
  • Knowledgebase
You are here: Home / Linux / Finding files

Finding files

2018-01-15 by Neil Leave a Comment

Locate

Locate searches a database (index) of all the files on the local system. You must update this database using the command: updatedb before running locate
Example:
updatedb
locate shadow.bak

 

Locate, by default, assumes a wildcard string. E.g. if you search for passwd, it actually looks for *passwd*. if you want it to just search for the whole word then use: locate ‘/passwd’. This will still find passwd.1 and passwd.2 but won’t find this_file_has_passwd_ entries.txt for example.

Which

The which command searches only the directories defined in the $PATH environment variable.

Example:
which passwd

Find

Find recursively searches a given path
Example:
find / -name passwd*
Here the path is / (root) and the name of the file is passwd with wildcard following it.

find can also be used to search for file properties like: size, date, ownership. It can also take a parameter which will execute a command for each

find / -name passwd.* -exec file {};    – this command finds files with the passwd.* pattern and then executes the file command on them, giving useful file information.

 

Filed Under: Linux

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

About Me

I’m currently a systems admin / consultant at a IT firm who looks after the computer systems of small businesses in the UK. IT security is only a part of that job. However I’ve always enjoyed breaking into, getting around, subverting and otherwise hacking things, systems and ideas. In tackling some low-level IT security tasks I reignited my interest in the field and this blog charts my progress in the world of Computer Security, legal Hacking, Penetration Testing, Infosec – whatever you want to call it. As a Windows guy I’m learning about Linux, shell-scripting, python and all the other skills needed in this field.

Tags

Apache Boot-to-Root CTF curl dib Dirbuster FreeBSD Hack The Box Linux mysql NFS Penetration Testing PHP RCE shell VulnHub Wordpress

Categories

© 2023 · NeilSec;