Add directory to path for sudo

6,635

IMO easiest way is to add those lines to /root/.bashrc

Alternately, you can add /home/asco/adt-bundle-linux-x86_64/sdk/tools and /home/asco/adt-bundle-linux-x86_64/sdk/platform-tools to /etc/environment

Last, you could, as root, move the sdk directory to a central location on root's path, such as /usr/local/lib.

Share:
6,635

Related videos on Youtube

fweigl
Author by

fweigl

Met Steve Ballmer the other day. Offered him to have a pic taken with me, he was so happy :^)

Updated on September 18, 2022

Comments

  • fweigl
    fweigl over 1 year

    I know creating a .bashrc and adding

    PATH=$PATH:/home/asco/adt-bundle-linux-x86_64/sdk/tools
    PATH=$PATH:/home/asco/adt-bundle-linux-x86_64/sdk/platform-tools
    

    will add those directories to my path. How do I do the same so the programs in those directories will be available with sudo? I tried the same as su in /root, but that didn't work.

  • Display Name
    Display Name over 3 years
    as of latest Ubuntu LTS, adding things to PATH in /etc/environment doesn't do it for commands ran under sudo.