Ubuntu Linux environment variables
Like Windows, the Ubuntu Linux system contains two types of environment variables: system environment variables and user environment variables. System environment variables are valid for all system users, and user environment variables are only valid for the current user.
User environment variables are usually stored in the following files:
The above files are not recommended for use in versions prior to Ubuntu 10.0.
System environment variables are generally stored in the following files:
/etc/profile and /etc/bash.bashrc are not recommended in Ubuntu 10.0 version.
Priority of Ubuntu Linux environment variables
The priority of several environment variables: 1>2>3
Set adb environment variables in Ubuntu Linux
vi ~/.bashrc (The bashrc file in the root default directory)
Add in this file: export PATH=/home/homer/android-sdk-linux/platform-tools/:$PATH
It takes effect after restarting or logging in again. If you want to take effect immediately, execute: source ~/.bashrc
su root
vi ~/.bashrc (The bashrc file in the root default directory)
Add in this file: export PATH=/home/homer/android-sdk-linux/platform-tools/:$PATH
It takes effect after restarting or logging in again. If you want to take effect immediately, execute: source ~/.bashrc
**1. **Realization ideas:
Create a soft link for adb in the default bin directory of PATH
**2. **View sudo $PATH: echo'echo $PATH' | sudo sh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
**3. **Enter sudo default PATH:
cd /usr/local/bin/
**4. **Establish soft link:
sudo ln -s /home/homer/android-sdk-linux/platform-tools/adb
**5. **In this way, in ordinary users (homer), super users (root), and sudo users, you can directly use the adb command, because the PATH environment variable of these users includes the directory /usr/local/bin
Ubuntu Linux cannot recognize the phone
homer@ubuntu:~$ adb devices
List of devices attached
???????????? no permissions
Ubuntu Linux starts phone recognition
homer@ubuntu:~$ sudo adb kill-server
homer@ubuntu:~$ sudo adb start-server
Reference recommendation:
The execution process of several files such as /etc/profile, ~/.bash_profile in Linux
Several ways and differences of setting environment variables in Ubuntu
Android real machine debugging garbled (no mobile phone recognition)
Recommended Posts