Linux Basic article

Source: Internet
Author: User

    1. Background knowledge

      Computer: Accept the user's instruction and data, after processing the data of the central processor and the logical unit, to produce or store the useful information.

      Computers include:

      (1) Input unit: such as keyboard, mouse, scanner, handwriting board and so on.

      (2) Central processing unit (CPU): Contains arithmetic logic, control, memory and other units.

      (3) Output unit: Display, printer.

      650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/04/wKioL1c0dlvw8uH_AAFj1Nr6XWs393.png "title=" 1.PNG " alt= "Wkiol1c0dlvw8uh_aafj1nr6xws393.png"/>

      Note: the memory here represents

      The data that the CPU reads is from memory, the CPU processes the finished data, must write back to the memory first, the final data transmits from the memory to the output unit (ignores the cache)

    2. Understanding of environment variables

      Linux is a multi-user operating system. Multi-user means that each user logs into the system and has their own dedicated operating environment. This environment is defined by a set of variables, which are called environment variables.


To make it easier to modify and view environment variables, first describe the commands for modifying and viewing environment variables:

(1) Echo displays an environment variable value

(2) Export set a new environment variable

(3) env Display all environment variables

(4) Set shows locally defined shell variables

(5) unset Clear Environment variables

(6) ReadOnly set read-only environment variables


Common environment variables in Linux:

(1) PATH: Specifies the search environment for the command echo $PATH

(2) Home: The user's main working directory

(3) Histsize: Refers to the number of history bars of the Save command

(4) LOGNAME: Login name of the current user

(5) HOSTNAME: Name of the host

(6) Shell: the kind of shell that the current user uses

(7) PS1: Command Base symbol $

(8) PS2: Secondary prompt > (prompt for current command not finished)

650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/07/wKiom1c0fkbSyg44AABUNt1NPv4641.png "title=" 3.PNG " alt= "Wkiom1c0fkbsyg44aabunt1npv4641.png"/>

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/80/04/wKioL1c0gBei_PkHAAA3ZXsAzY4236.png "title=" 4.PNG " alt= "Wkiol1c0gbei_pkhaaa3zxsazy4236.png"/>

3. File types for Linux

(1) Ordinary file (plain text file, binary file, data format file) The first character is [-]

(2) The first character of a directory is [d]

(3) Connection file (soft connection, hard connection) the first character is [l]

(4) Equipment and equipment files (block devices [b], character devices [C])

(5) Socket (data interface file) The first character is [s]

(6) Pipeline (FIFO) The first character is [P]

4. Extensions for Linux

Basically, Linux files do not have the so-called "extension", a Linux file can be executed, only the first column of its 10 attributes, and the file name has no relationship at all. As long as you have x in your permission, this file can be executed.

But I don't know if we can do it successfully. So this x can only represent the executable ability of this file, but can not be executed successfully, depends on the contents of the file.

such as [drwxr-xr-x] this file executable.


Although the extension doesn't work, people are accustomed to using extensions to understand what the file is.

. SH: script or batch file

. Z. Tar. tar.gz. zip. tgz: Packaged Compressed files

. html. PHP: Web-related files


4. How Linux Shell commands work

Linux is strictly speaking of an operating system, we call it "core (kernel)", but we generally users, cannot directly use kernel. Instead, it communicates with kernel through kernel's "shell" program, the so-called shell.


Technically, the simplest definition of the shell: the command-line interpreter

Mainly include:

(1) Translating the user's name into core processing

(2) At the same time, the core processing results are translated by the user

For Linux, the shell is primarily parsing our instructions and parsing instructions to the Linux kernel. Feedback results are run through the kernel and parsed to the user through the shell.


How does the shell run the program?

The shell creates a new process with fork, runs the user-specified program in the new process with the EXECV function cluster, and finally the shell waits for the new process to end with the wait command. The wait system call also takes an exit state from the kernel or a sequence of signals to tell the subroutine how to end it.


5. Linux Rights Management (one thing is allowed to be done by whom?) person, thing attribute)

(1) Classification of file Visitors (people)

<1> owner of file and file directory: U---User

<2> user of the group that owns the file and file directory: G---Group

<3> other users: o---Others

(2) Types of file access rights (attributes of Things)

<1> Basic Permissions

I. Read (R/4): Read has permission to read the contents of the file, and for the directory to browse the directory information

II. Write (W/2): Write to the file, with the right to modify the contents of the file, for the directory to delete files in the Move directory permissions

III. Execute (X/1): Execute has permission to execute files to file, with permission to enter directory for directory

Iv. "-" means not having this permission

such as [Drwxr-xr-x]

D---Directory

Three three separate---groups of owners---other

RWX r-x R-x

owner: Permission to have a readable writable executable

Group: With readable and non-writable executable permissions

Other: With readable and non-writable executable permissions



This article from "Together to see the Stars" blog, reproduced please contact the author!

Linux Basic 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.