Finding Binaries in the PATH Variable with which




Download 7,3 Mb.
Pdf ko'rish
bet34/125
Sana14.05.2024
Hajmi7,3 Mb.
#232858
1   ...   30   31   32   33   34   35   36   37   ...   125
Bog'liq
linuxbasicsforhackers

Finding Binaries in the PATH Variable with which
The 
which
command is even more specific: it only returns the location of 
the binaries in the 
PATH
variable in Linux. We’ll look more closely at the 
PATH
variable in Chapter 7, but for now it’s sufficient to know that 
PATH
holds 
the directories in which the operating system looks for the commands you 
execute at the command line. For example, when I enter 
aircrack-ng
on 
the command line, the operating system looks to the 
PATH
variable to see 
in which directories it should look for aircrack-ng:
kali >
which aircrack-ng
/usr/bin/aircrack-ng
Here, 
which
was able to find a single binary file in the directories listed 
in the 
PATH
variable. At minimum, these directories usually include /usr/bin
but may include /usr/sbin and maybe a few others.


Getting Started with the Basics
11
Performing More Powerful Searches with find
The 
find
command is the most powerful and flexible of the searching utili-
ties. It is capable of beginning your search in any designated directory and 
looking for a number of different parameters, including, of course, the file-
name but also the date of creation or modification, the owner, the group, 
permissions, and the size.
Here’s the basic syntax for 
find
:
find 
directory options expression
So, if I wanted to search for a file with the name apache2 (an open source 
web server) starting in the root directory, I would enter the following:
kali >
find /

 -type f

 -name apache2
w
First I state the directory in which to start the search, in this case 
/


Then I specify which type of file to search for, in this case 
f
for an ordi-
nary file 

. Last, I give the name of the file I’m searching for, in this case 
apache2
w
.
My results for this search are shown here:
kali >

Download 7,3 Mb.
1   ...   30   31   32   33   34   35   36   37   ...   125




Download 7,3 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



Finding Binaries in the PATH Variable with which

Download 7,3 Mb.
Pdf ko'rish