I have placed a directory named “platform-tools” under my UM 18.04 home directory. I would like to be able to run these files without using the full path name. I have googled the issue, and there seem to be many methods to accomplish this, but I don’t fully understand most of the directions.
Method 1
add line
export PATH="$PWD/platform-tools:$PATH"
to
~/.bashrc
Method 2
run the following commands:
$ PATH = /usr/local/sbin:/usr/local/bin:~/platform-tools
$ source /etc/environment && export PATH
Just looking for some advice before messing everything up and having to restore from a backup. Thanks.
Thanks. That site was easier for me to follow than the others. I did not realize you could set the path just for the current login. That might be my best solution.
However, it did not fix my issue. And I am even more confused. ADB does not run. I do the PATH command, ADB runs. But fastboot in the same directory is not recognized unless I go to the desired directory and run ./fasboot. Below is a list of my commands supporting the description of my experience:
jaybo@UM18:~$ adb
Command 'adb' not found, but can be installed with:
sudo apt install adb
jaybo@UM18:~$ PATH=$PATH:/home/jaybo/platform-tools;export PATH
jaybo@UM18:~$ adb devices
* daemon not running; starting now at tcp:5037
* daemon started successfully
List of devices attached
jaybo@UM18:~$
$ sudo fastboot devices
sudo: fastboot: command not found
jaybo@UM18:~$ cd platform-tools
jaybo@UM18:~/platform-tools$ ls
adb dmtracedump etc1tool hprof-conv make_f2fs mke2fs.conf sload_f2fs sqlite3
api e2fsdroid fastboot lib64 mke2fs NOTICE.txt source.properties systrace
jaybo@UM18:~/platform-tools$ sudo fastboot devices
sudo: fastboot: command not found
jaybo@UM18:~/platform-tools$ sudo ./fastboot devices
XXXXXXXX fastboot
jaybo@UM18:~/platform-tools$
fastboot perms are ok, the issue is that sudo resets PATH.
you should have a /etc/sudoers file, ls -l /etc
-r--r----- 1 root root 755 Jan 17 2018 sudoers
you can see it as root or sudo cat /etc/sudoers
To change it, use sudo visudo
sudo visudo, look for the line Defaults secure_path= (mine is the third line after the comments) and add to the end of that path, your path /home/jaybo/platform-tools Save, exit. Now, go to your home dir and type sudo fastboot devices It should work.
FROM Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
TO Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/jaybo/platform-tools"