Linux basics for Android

Source: Internet
Author: User

I. linux root directory structure

 

Directory Name

Description

Bin

User-level binary Tool

Boot

LinuxKernel image files and boot-related files, which are read and loaded by the bootloader program

Dev

Various system hardware devices

Etc

System configuration files and other configuration files

Home

User working directory

Lib

Various library files required for system running

OPT

Directory of additional applications installed in the operating system

Proc

The virtual system file of the kernel and process. This directory does not occupy disk space and its data is stored in the memory.

Root

Administrator working directory

Sbin

The binary tool in this directory is only used by the Administrator.

Sys

It is generally the virtual system file corresponding to the driver.

USR

Manage installed applications that are accessible to all users

VaR

Place files that frequently change during system execution, such as debugging information files or related statistical files

 

 

II,LinuxStartup Process

 

The first step is to start the system and power the system. At this time, the hardware circuit will generate a definite reset sequence to ensure that the CPU is the last device to be reset. After a correct reset, the CPU starts to execute the bootloader program to load programs such as the kernel.

Step 2: Execute the kernel program. During Kernel Program initialization, execute initialization of various hardware, including memory, display, network interface, and input device, then, various internal data structures required for Thread Scheduling and memory management are established.

The third part is to run the Home program, such as Windows desktop. This program allows you to easily start other applications.

 

III,AndroidCommon Linux commands during development

● Man

ManMeaning is manual, that is, manual. The format is man command, and command is the specific command name.

● Find

FindCommand to find a file or folder, for example:

$ Find.-Name "*. Java"

Where. indicates the current directory.

● Grep

GrepCommand is used for string matching. For example, to find all the places in the hello. Java file that contain the "activity" string, run the following command.

$ Grep "activity" Hello. Java

● Xargs

This command can be understood as an identifier that represents the execution result of the previous command and serves as a parameter of the next command. Linux commands can be executed in a pipeline. The two commands are separated by the "|" separator. The following is an example:

$ Ls | xargs grep "OA"

Find all files whose names contain "OA" in the current directory.

$ Find.-Name ". Java" | xargs grep "activity"

Find all java files in the current directory that contain the "activity" string.

$ Find 'Find.-Name res'-name "*. xml" | xargs grep status_bar_size

In this command, the ''symbol is the symbol on the left of the number key 1. Here, the find command is used for nesting. The embedded find command is used to find the directory or file named res, the external find command continues searching from these directories. XML file.

● Cat

CatCommand is used to link the file content and output the file content. Files in the cat parameter can be files with storage space in the general sense, or device files in the Linux system.

 

$ Cat main. Java
$ Sudo CAT/dev/disk0

 

● Chmod

In Linux, file visitors are divided into three types, and different access permissions are assigned to these three types of users.

USR (u)User, that is, the user who creates the file

Group(G) User Group

Other(O) other users

ChmodThe command is used to set the access permissions of these three types of visitors to a file.

Access Permissions are divided into read (R), write (w), and execution (x) permissions. You can use the LS-l command to view the object access permissions.

LinuxUse 10-bit data to indicate the access permission. For example, "drwxr-XR-X", which is described below

Bit0: Use-or D. The former indicates a file, and the latter indicates a directory.

Bit1-bit3: User access permission

Bit4-bit6: Group access permission

Bit7-bit9: Other access permission

ChmodCommand application example

$ Chmod U + x copy. Sh

That is, add the execution (x) permission to the user. A can also be used to represent three types of users, such as a + X.

For Linux at the underlying level of Android phones, the CHMOD command does not recognize parameters such as R, W, and X, but can only be represented by octal numeric values, for example:

$ Chmod 777 copy. Sh

777 represents the number of octal users, and the corresponding binary data is 111 111 111, representing the access permissions of users U, G, and O.

● Ps, kill

PSUsed to list all processes currently running and kill to kill a process. These two commands are mostly used for system debugging.

● Export

This command is used to set the scope of a variable value to a global range. For example, a path can be assigned to the path of the system environment variable, and then export path

 

Related Article

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.