Ubuntu environment variables and ADB configuration

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

  1. /etc/profile: When logging in, the first file used by the operating system to customize the user environment. This file sets environment information for each user of the system. This file is automatically executed when the user logs in for the first time.
  2. /etc/environment: The second file used by the operating system when logging in. The system sets the environment variables of the environment file before reading your own profile.
  3. ~ /.bash_profile: The third file used when logging in is the .profile file. Each user can use this file to enter shell information dedicated to his own use. When the user logs in, the file is executed only once! By default , He sets up some environment variables and executes the user's .bashrc file. /etc/bashrc: This file is executed for each user who runs the bash shell. When the bash shell is opened, the file is read.
  4. ~ /.bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log in and every time you open a new shell.
  5. /etc/bash.bashrc: A script that is automatically executed when the user enters the shell or desktop system

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

Ubuntu environment variables and ADB configuration
Ubuntu 19.1 installation and configuration Chinese environment
Ubuntu configuration development environment
Ubuntu development environment configuration
Install JDK and configure environment variables on Ubuntu 16.04
ubuntu sets python2.5 environment variables
Ubuntu16.04 installation and simple configuration
Ubuntu16.04 install SVN and configuration
Ubuntu PostgreSQL installation and configuration
Ubuntu 18.04.1 build Java environment and HelloWorld
Ubuntu16.04 configuration OpenCV3.4.2 and basic use
Configuration and beautification after Ubuntu installation (1)
Nginx installation and configuration load (ubuntu12.04)
Ubuntu configuration source and installation software
JDK environment variable configuration method under ubuntu
Ubuntu install PHP and PHP Nginx configuration method
DLNA/UPnP Server installation and configuration under Ubuntu 12.04
ubuntu 18.04 early configuration
Deep learning environment configuration guide! (Full explanation on Windows, Mac and Ubuntu)
Ubuntu nfs configuration
Ubuntu20.04 configuration notes
Ubuntu 14.04 configuration record
Debian and Ubuntu installation source configuration file description
The basic configuration and interface beautification of Ubuntu
Virtual machine installation and configuration ubuntu shared folder_
Kaldi installation and configuration graphic tutorials under Ubuntu
Basic configuration and common software installation after ubuntu 18.04 installation
Installation, configuration and uninstallation of GitLab in Ubuntu19.1
Installation and use of SSH in Ubuntu environment
ubuntu16.04 deploy GPU environment
Ubuntu16.04 mirror complete installation and configuration tutorial under VMware
[Linux] ubuntu install configuration vsftpd and lock the directory
Summary: Ubuntu Python2.x and
ubuntu configuration python, Red
OpenMPI-Ubuntu installation and configuration
Embedded Linux development environment to build and configure Ubuntu
Ubuntu20.04 experience and beautification
Ubuntu 18.04 network card configuration
Ubuntu introduction and installation
[python] python2 and python3 under ubuntu
Network configuration under Ubuntu
Python virtual environment: Ubuntu16.04
023. Ubuntu common personalized configuration
Ubuntu Touch environment setup
Installation and simple practice of MySQL in ubuntu environment (1)
Ubuntu12 step-by-step installation and configuration (system, FTP, TELNET.. settings)
Ubuntu18.10 configure Java environment
Lesson 002 ubuntu environment construction and ubuntu graphical interface operation (free)
Environment configuration of JDK, mysql and tomcat under Centos7
Linux firewall related configuration commands and operations (centos and ubuntu)
Python3 configuration and entry.md
Common exceptions and solutions for Ubuntu system installation and configuration
Ubuntu backup and restore
ubuntu environment deployment project
Install and configure Mono production environment on Ubuntu Server
How to install memcache and start it in ubuntu environment
How to compile and install PHP and Nginx in Ubuntu environment
Django&MySQL environment deployment under Ubuntu 14.04
Python introduction and environment installation
ubuntu16.04 build vim and pyt
Centos mysql installation and configuration