Читать книгу Kali Linux Penetration Testing Bible - Gus Khawaja - Страница 31
TIP
ОглавлениеUse the grep
command to get more granular results.
To find an application path, use the which
command. This command will use the $PATH
environment variable to find the results that you're looking for. As an example, to find where Python is installed, you can do the following:
$which [application name] root@kali:/# which python /usr/bin/python
It's important to understand that a Linux system will use $PATH
to execute binaries. If you run it in the terminal window, it will display all the directories where you should save your programs/scripts (if you want to execute them without specifying their path):
root@kali:/# $PATH bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin: No such file or directory
Let's look at a practical example; I saved the test.sh
file in my home directory. Since the home folder is not in the $PATH
variable, this means that I can execute it only if I specify the path or else it will fail:
root@kali:~# test.sh bash: test.sh: command not found root@kali:~# ./test.sh test
Another useful command to find files with more flexible options is the find
command. The advantage of using the find
tool is that it allows adding more granular filters to find what you're looking for. For example, to find file1.txt
under the root home directory, use this:
root@kali:~# find /root -name "file1.txt" /root/temp/file1.txt
Let's say you want to list the large files (1GB+) in your system:
root@kali:~# find / -size +1G 2> /dev/null /proc/kcore