• Finding Binaries with whereis
  • Finding Binaries in the PATH Variable with which
  • Chapter 1 Searching with locate




    Download 7,3 Mb.
    Pdf ko'rish
    bet32/115
    Sana27.11.2023
    Hajmi7,3 Mb.
    #106243
    1   ...   28   29   30   31   32   33   34   35   ...   115
    Bog'liq
    linuxbasicsforhackers

    10
    Chapter 1
    Searching with locate
    Probably the easiest command to use is 
    locate
    . Followed by a keyword denot-
    ing what it is you want to find, this command will go through your entire 
    filesystem and locate every occurrence of that word.
    To look for aircrack-ng, for example, enter the following:
    kali >locate aircrack-ng
    /usr/bin/aircrack-ng
    /usr/share/applications/kali-aircrack-ng.desktop
    /usr/share/desktop-directories/05-1-01-aircrack-ng.directory
    --snip--
    /var/lib/dpkg/info/aircrack-ng.md5sums
    The 
    locate
    command is not perfect, however. Sometimes the results of 
    locate
    can be overwhelming, giving you too much information. Also, 
    locate
    uses a database that is usually only updated once a day, so if you just created 
    a file a few minutes or a few hours ago, it might not appear in this list until 
    the next day. It’s worth knowing the disadvantages of these basic commands 
    so you can better decide when best to use each one.
    Finding Binaries with whereis
    If you’re looking for a binary file, you can use the 
    whereis
    command to 
    locate it. This command returns not only the location of the binary but 
    also its source and man page if they are available. Here’s an example:
    kali >whereis aircrack-ng
    aircarck-ng: /usr/bin/aircarck-ng /usr/share/man/man1/aircarck-ng.1.gz
    In this case, 
    whereis
    returned just the aircrack-ng binaries and man page, 
    rather than every occurrence of the word aircrack-ng. Much more efficient 
    and illuminating, don’t you think?
    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

    Download 7,3 Mb.
    1   ...   28   29   30   31   32   33   34   35   ...   115




    Download 7,3 Mb.
    Pdf ko'rish