L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h




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

find / -type f -name apache2
/usr/lib/apache2/mpm-itk/apache2
/usr/lib/apache2/mpm-event/apache2
/usr/lib/apache2/mpm-worker/apache2
/usr/lib/apache2/mpm-prefork/apache2
/etc/cron.daily/apache2
/etc/logrotate.d/apache2
/etc/init.d/apache2
/etc/default/apache2
The 
find
command started at the top of the filesystem (
/
), went through 
every directory looking for apache2 in the filename, and then listed all 
instances found.
As you might imagine, a search that looks in every directory can be 
slow. One way to speed it up is to look only in the directory where you would 
expect to find the file(s) you need. In this case, we are looking for a con-
figuration file, so we could start the search in the /etc directory, and Linux 
would only search as far as its subdirectories. Let’s try it:
kali >
find /etc -type f -name apache2
/etc/init.d/apache2
/etc/logrotate.d/apache2
/etc/cron.daily/apache2
/etc/default/apache2
This much quicker search only found occurrences of apache2 in the
/etc directory and its subdirectories. It’s also important to note that unlike 
some other search commands, 
find
displays only exact name matches. If the 


12
Chapter 1
file apache2 has an extension, such as apache2.conf, the search will not find a 
match. We can remedy this limitation by using wildcards, which enable us to 
match multiple characters. Wildcards come in a few different forms: 
*
.
,
?
and 
[]
.
Let’s look in the /etc directory for all files that begin with apache2 and 
have any extension. For this, we could write a 
find
command using the fol-
lowing wildcard:
kali >

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




Download 7,3 Mb.
Pdf ko'rish

Bosh sahifa
Aloqalar

    Bosh sahifa



L in u X ba sics for h acke rs g e t t I n g s t a r t e d w I t h

Download 7,3 Mb.
Pdf ko'rish