• How Not to Add to the PATH Variable
  • 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
    bet91/125
    Sana14.05.2024
    Hajmi7,3 Mb.
    #232858
    1   ...   87   88   89   90   91   92   93   94   ...   125
    Bog'liq
    linuxbasicsforhackers

    PATH=$PATH:/root/newhackingtool


    Managing User Environment Variables
    77
    This assigns the original 
    PATH
    variable plus the /root/newhackingtool 
    directory to the new 
    PATH
    variable, so the variable contains everything it did 
    before, plus the new tool directory.
    If you examine the contents of the 
    PATH
    variable again, you should see 
    that this directory has been appended to the end of 
    PATH
    , as shown here:
    kali >
    echo $PATH
    /usr/local/sbin:usr/local/bin:/usr/sbin:/sbin/bin:/root/newhackingtool
    Now you can execute 
    newhackingtool
    applications from anywhere on 
    your system, rather than having to navigate to its directory. The bash shell 
    will look in all directories listed for your new tool!
    N O T E
     
    Adding to 
    PATH
     can be a useful technique for directories you use often, but be careful 
    not to add too many directories to your 
    PATH
     variable. Because the system will have to 
    search through each and every directory in 
    PATH
     to find commands, adding a lot of 
    directories could slow down your terminal and your hacking.
    How Not to Add to the PATH Variable
    One mistake commonly made by new Linux users is assigning a new direc-
    tory, such as /root/newhackingtool, directly to the 
    PATH
    variable in this way:
    kali >
    PATH=/root/newhackingtool
    kali >
    echo $PATH
    /root/newhackingtool
    If you use this command, your 
    PATH
    variable will only contain the /root/
    newhackingtool directory and no longer contain the system binaries direc-
    tories such as /bin/sbin, and others that hold critical commands. When 
    you then go to use any of the system commands, you’ll receive the error 
    command not found
    , as shown next, unless you first navigate to the system 
    binaries directory when you execute the command:
    kali >
    ls
    bash: ls: command not found
    Remember that you want to append to the 
    PATH
    variable, not replace it. 
    If you’re in doubt, save the contents of the variable somewhere before you 
    modify it.

    Download 7,3 Mb.
    1   ...   87   88   89   90   91   92   93   94   ...   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