Exercise 3, Chapter 3 – Searching [in/for] files
- Try out the dmesg command which prints the message buffer of the kernel. The output of this command typically contains the messages produced by the device drivers.
- Use the find command to find the file named rockyou.txt.gz on the filesystem.
- Use the locate command to find the file named rockyou.txt.gz on the filesystem
- Which completed faster: find or locate? Why?
- Can you figure out how to “time” the commands to figure out the actual amount of time it takes for the commands to complete?
Please note that if you are having trouble with basic Linux commands and concepts, you should strongly consider taking a free Linux course (like this one) before continuing your Kali training. Remember, Kali Linux in not for Linux beginners!
- This one is pretty simple:
1dmesg | more
- The find command:
1find / -name rockyou.txt.gz
- The locate command:
- The locate command should have taken less time, as rather than really searching the whole filesystem for a specific file, the locate command searches a precompiled database for the requested file. In case you’re wondering, this database is generated as part of the Kali ISO build, using the “updatedb” command. You can use file, then zcat to process this file.
- Try out the time command. 😉