Ubuntu environment variables and ADB configuration (reprint)

Source: Internet
Author: User

Transferred from: http://blog.csdn.net/ithomer/article/details/7307449

Like Windows, Ubuntu Linux systems contain two types of environment variables: system environment variables and user environment variables. The system environment variable is valid for all system users, and the user environment variable is only valid for the current user.

User environment variables are typically stored in the following file:

  • ~/.profile
  • ~/.bash_profile or ~./bash_login
  • ~/.bashrc

The above files are not recommended for use in previous versions of Ubuntu 10.0.

The system environment variables are generally stored in the following file:

  • /etc/environment
  • /etc/profile
  • /etc/bash.bashrc

/etc/profile and/ETC/BASH.BASHRC are not recommended for use in Ubuntu version 10.0.

Priority for Ubuntu Linux environment variables

  1. /etc/profile: The first file that is used when the operating system customizes the user environment at logon, which sets the environment information for each user of the system, which is automatically executed when the user logs on for the first time.
  2. /etc/environment: The second file used by the operating system at logon, the system sets environment variables for environment files before reading your own profile.
  3. ~/.bash_profile: The third file that is used to log on is the. profile file, which each user can use to enter shell information that is specific to their own use, which is executed only once when the user logs on. By default, he sets some environment variables, Executes the user's. bashrc file. /ETC/BASHRC: Executes this file for each user running 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, which is read when you log in and every time you open a new shell.
  5. /ETC/BASH.BASHRC: Scripts that are automatically executed when a user enters a shell or desktop system

Priority of several environment variables: 1>2>3

setting ADB environment variables in Ubuntu Linux

    • Current User (Homer)

VI ~/.BASHRC (BASHRC file in root default directory)

In this file, add: Export path=/home/homer/android-sdk-linux/platform-tools/: $PATH restart or re-login to take effect, if you want to take effect immediately, then execute: source ~/.BASHRC
    • Super User (Root)
Su rootvi ~/.BASHRC (bashrc file in the root default directory) is included in this file: Export path=/home/homer/android-sdk-linux/platform-tools/:$ Path restarts or re-login to take effect, if you want to take effect immediately, then execute: source ~/.BASHRC

 

    • Global Settings (Homer, Root, sudo)
1.Implementation of the idea: in the path default bin directory, the new ADB soft link 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.Go to sudo default path:cd/usr/local/bin/ 4.Create a soft link: sudo ln-s/home/homer/android-sdk-linux/platform-tools/adb 5.In this way, the ADB command can be used directly in the normal user (Homer), Superuser (root), sudo user, as these users ' path environment variables contain directories /usr/local/bin

Ubuntu Linux does not recognize the phone

[Email protected]:~$ ADB devices
List of devices attached
???????????? No permissions

Ubuntu Linux Startup phone recognition

[Email protected]:~$ sudo adb kill-server
[Email protected]:~$ sudo adb start-server
* Daemon not running. Starting it now on Port 5037 *
* Daemon started successfully *
[Email protected]:~$ ADB devices
List of devices attached
FM6111131707Device

Reference recommendation:

Linux/etc/profile, ~/.bash_profile, and several other files of the implementation process

Several ways and differences of setting environment variables in Ubuntu

Android Real Computer debugging garbled (not recognized phone)

Ubuntu environment variables and ADB configuration (reprint)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.