Original Linux-day1

Source: Internet
Author: User

Original: Forwarding must indicate the source http://www.cnblogs.com/0zcl/p/6077298.html

first, the basic principles of Linux
    1. Composed of small programs with a single purpose: combining small programs to complete complex tasks
    2. All documents
    3. Try to avoid capturing the user interface
    4. The configuration file is saved in plain text format

ii. basic knowledge of Linux

1. Interface

GUI interface: graphical interface Graphic User Interface

CLI Interface: Command prompt, prompt, bash (shell)

    • #:root
    • $: Normal User

2. Command format

Command format: Command option parameter

Options:

Short options:-for example:-l,-a ...

Multiple options can be combined:-a-b =-ab

Long options:--

Generally cannot be combined

Parameters: The Action object of the command

Ps:linux Strictly case-sensitive

3. User authentication

Change Password: #passwd

Switch User: SU user name

SU is the abbreviation for switch user

Standard Password:

    1. Use at least 3 of the 4 kinds of characters wrongly written characters
    2. Long enough, greater than 7 bits
    3. Regular replacement
    4. The cycle period is large enough
    5. Using random strings

PS: Of course, not according to the above standards can also, such as my password set 123

Login: User name User ID

Authentication mechanism: Authentication

Authorization: Authorization (permission Assignment)

Audit: Audition (log)

PS: These first understand, later will speak ...

iii. Basic Linux commands

1. PWD ls ls-l

PWD: Show current directory

LS: Displays the files in the current directory

Ls-l: Display full information (ls:list L:long full information about the file in the current directory)

2. File Types

You will find-rw-r--r--when you use the #ls-l command, what kind of ghost is this?

There is a total of 10 characters, the first representing the file type, and the last 9 representing the file permissions

File type: the

    • -: Normal file (f)
    • D: Catalog file
    • B: Block device files (blocks)
    • C: Character device file (character)
    • L: Symbol device files (symbolic link file)
    • P: Command pipe file (pipe)
    • S: Socket file (socket)

Next, analyze what the following differences mean.

    • file Permissions : 9-bit, each 3-bit group, each group is: rwx (read, write, execute),-indicates: cannot. For example: rw-that can read can write cannot execute
    • Number of hard links to file (later)
    • Owner of the file
    • Genus Group of files
    • File size (size): units are bytes
    • Timestamp (timestamp): The time that was recently modified

PS: Each file has 3 timestamp

    • Recently Accessed time access
    • Recently modified time modify change the contents of the file
    • Changed time change file properties/Meta data

You may ask: is the modified time and the changed time have yarn different?

In fact, a file has two kinds of data

    • File own data
    • File meta data (metadata)

For example: only change the filename, the file content is unchanged, GET IT?

3. Command-h/-a/./. /-a/-d/-r/-r

-H: Do unit conversions

-A: Displayed with. Hidden files at the beginning

. : Represents the current directory

..: Indicates parent directory

-I: Displays the miniature node number of the file (a unique numeric identifier for the file) I is the abbreviation for index node

-R: Recursive display (recursive)

-R: Reverse Display

4. Cd/type

CD: Toggle the current working directory

    • CD: Do not add directory, then go home directory/home Directory
    • CD ~username: Enter the home directory of the specified user
    • CD-: Switch back and forth between the current directory and the previous directory

Type: shows what kind of command it belongs to

What are the different types of commands?

Command type:

    • Built-in commands (shell built-in)
    • External command: There is an executable file corresponding to the command name in a path on the file system

Look at the picture below to know for sure!

5. Printenv/hash/useradd

PRINTENV: Print Environment variables

Too much data, ignoring part of ...

Note Here the path variable : (a colon-separated path)

Function: When the command is executed, it is searched in the path in turn until the first time it is found

Then the problem comes, to know the system command is a lot of, if a program contains a lot of commands, that every time the execution of the command to go to the path, it is a waste of time ah!!

WORKAROUND: If the first command is found in path, the command and the corresponding path are cached (can be viewed with the hash command), the second execution of the same command will not go to the path

Okay, now, let's talk about the hash command .

Hash: Caches the previous commands and paths.

Hash table: Find Fast. Why use a hash table, which is related to the efficiency of the algorithm. Have a chance to say it again.

Useradd: Creating Users and switching users

6. Date/man

Date: Time Management

Strange, how can there be two kinds of time, and the time is not the same?

In fact, Linux has two kinds of time:

    • Hardware Clocks Clock
    • System Clock Date

Specific how to modify the time I will say below ...

Get command Use Help:

    • Internal command: Help command
    • External command: Command--help
    • View command Manual (Manual): Man command
    • Displays summary information for the command, along with the section that appears: Whatis command
    • Online Documentation: INFO command (document in:/usr/share/doc directory)

Here are some of the test examples:

(Press Q to exit)

To everyone diligent studious struggle spirit, should not ask above Man CD under Bash_builtins (1) what mean!

Bash_buitins: The description CD is an internal command of the bash shell, and what is 1?

The first thing to know

Man is divided into chapters, with the following 8 common chapters:

    1. User commands: Commands that all users can use
    2. System calls
    3. Library calls
    4. Special files (device files)
    5. File format (configuration file syntax)
    6. Game
    7. Miscellaneous: miscelianeous
    8. Manage commands

The noun in the man command manual:

    • Name: command names and features brief description
    • Synopsis: Usage notes, including available options
    • DESCRIPTION: A detailed description of the command function, which may include the meaning of each option
    • Options: Explaining the meaning of each option
    • Files: The configuration file associated with this command
    • BUGS:
    • EXAMPLES: Using the example
    • See ALSO: Another reference

Flip Screen:

    • Turn back one screen: SPACE
    • Turn One screen forward: b
    • Turn back one line: ENTER
    • Turn One line forward: K

Find:

    • /keyword: Looking backwards
    • ? KEYWORD: Looking forward

N: Next
N: Previous

Q: Exit

Zhong date[...| ...] What do you mean by [] and |?

    • [] Optional
    • <> must choose the
    • ... can appear multiple times
    • | Choose one More
    • {} grouping

Yes, I have said before to modify the time, it is very simple, according to it, let's try

I think it makes a lot of sense, which means we can view the information through the Man command, modify/output the relevant data!

such as the following:

The front said a lot about the man command, let's hurry into the next point. (Mom, the first time to write how long blog ...)

7. hwclock-w/hwclock-s/cal

    • HWCLOCK-W: Synchronizing the system time to the hardware, whichever is the system
    • Hwclock-s: Synchronizing hardware time to the system, whichever is the hardware time

Read time:

Cal: View Calendar (is abbreviated for calendar)

Iii. Exercises and Assignments

Exercise 1:
1.echo is an internal command or an external command
2. Its role
3. How to display "The year is 2016." Today is 17 "for two lines?"

Exercise 2:
1.print is an internal command or an external command
2. Its role
3. How to display "The year is 2016." Today is 17 "for two lines?"

Exercise 3:
File command and its usage??

I want to know the funeral, tell

Original Linux-day1

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.