Finding files in Kali Linux
One of the most troublesome experiences that most newbies of the Linux platform, usually face is the inability to find the simplest and yet more effective means of looking up files on their system.
Linux, like almost any other operating system, utilizes several mechanisms to answer search queries for users.
There are 3 major utilities that are used to find files:
The fastest utility is “locate” whereas the most effective one is “Find” there are n numbers of possibilities with “Find” tool.
I will explain all the pros and cons of these tools in detail below separately:
- Locate: locate tool is the faster utility as compared to “find” since “locate” uses a database to satisfy the search query. The locate command takes less than a second. I wouldn’t though trust “locate” for parsing it since its result depends upon the state of the internal database and it’s only scheduled to run from /etc/cron.daily/mlocate, and
updatedbonly run once a day by default. Locate command gives you exact path of the file name queried by searching through the database.
- Find: find is live. It filters, excludes, executes. It’s suitable for parsing. It can output relative paths. It can output full paths. It can do things based on attributes, not just names. Find command is slow as compared to Locate and other file finding utilities. It gives you only file name.
- Which: On a Linux operating systems, the which command locates the executable files associated with a given command. had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. It
does not canonicalize path names.