Learning notes for basic Linux learning

Source: Internet
Author: User
Tags new set perl regular expression repetition egrep

What is Linux

1. The core prototype of Linux was written by Torvalds (Linus Torvalds) in 1991.

2, 1973: The formal Birth of Unix, Ritchie and other people in C language to write the first official UNIX core.

3, 1977: The Birth of the important UNIX branch--bsd (Berkeley software distribution).

4, currently known as pure UNIX refers to system V (T) and BSD (SUN) these two sets.

5. In 1984, Storman began the GNU program, which aims to establish a free, open UNIX operating System (Unix).

6, the main, the minor version is odd: the development version.

7, primary, minor version is even: stable version.

8, distribution is divided into two major systems, one is to use the RPM method to install the software system, including Red Hat, fedora,suse and so on, one is the use of Debian dpkg way to install software systems, including Debian,ubuntu, B2d and so on.

9, the characteristics of Linux 1, low hardware requirements, 2, the structure of open, 3, system stability and confidentiality can be strong, 4, completely free.

10, the composition of Linux distribution contains: Linux kernel + Free software +documentations (tools) + can be fully installed program, composed of a complete set of systems.

How to learn Linux

1, Calculator introduction and hardware-related knowledge;

2, first from the installation and instruction of Linux;

3, the basic skills of Linux operating system;

4, must learn VI document editor;

5, Shell and shell script learning;

6, must be software administrators;

7, the establishment of the Network Foundation.

Virtual machine installation Process

1, Network type: Bridge network, use network address translation, only the host mode network each represents what meaning.

2, I/O control type: SCSI controller: buslogic, LSI Logic, LSI logic SAS what each of them mean.

3, the disk type: IDE, SCSI, SATA each represents what meaning.

Common directives and Tips date

#显示日期的指令.

Cal

#显示日历的指令.

Bc

#简单好用的计算器, enter qiut leave BC this calculator.

TAB key

Function:

1, command completion.

2, the file is filled.

* #Tab接在一串指令的第一个字的后面, the command is complete.

* #Tab接在一串指令的第二个字以后时, the file is padded.

Ctrl + C keys

#让当前的程序停掉.

Ctrl +d Keys

#Ctrl +d key means: keyboard input ends (end of file,eof or end of input) meaning!

#另外, he can also be used to replace the input of exit! For example, if you want to leave the text interface, you can simply press Ctrl+d to leave.

Mans page

#查询指令的用法和相关参数的说明.

#指令后面跟的数字表示的内容:

#其中1, 5, 83 numbers are of particular importance.

#man the part of the page that contains the content:

#还可能会看到Authors与Copyright等.

Info page

The purpose of #info与man is almost always to query the usage of the instruction or the format of the file. But unlike the man page, which outputs a bunch of information, the info page splits the file data into a single paragraph, each with its own page, and a "HYPERLINK" to a page similar to each page to jump to different pages, and each individual page is called a node ( node).

1, File: The information on behalf of this info page is from the Info.info file provided;

2, Node: Represents the current page is the top node. It means that info.info contains a lot of information, and top is only a node content in the Info.info file;

3, Next: The name of the next node is gettingstarted, you can also press "N" to the next node;

4, up: Back to the previous layer of the node overview screen, you can also press "U" back to the previous layer;

5, Prev: the previous node. But because top is the first node of Info.info, there is no information on the previous node.

Nano

#超简单文字编辑器.

1, [ctrl]-g: Get on-line help, very useful!

2, [ctrl]-x: Leave the Naon software, if you have changed the file will be prompted to store Oh!

3, [Ctrl]-o: Storage files, if you have the authority to be able to store files;

4, [ctrl]-r: from other files read into the information, you can attach a file of the contents of this file;

5, [ctrl]-w: Search string, this is also very helpful instructions Oh!

6, [ctrl]-c: Description of the current cursor where the number of rows and columns and other information;

7, [Ctrl]-_: You can enter the line number directly, so that the cursor quickly moved to the line;

8. [Alt]-y: Correction grammar function on or off (click on, then click Off)

9, [ALT]-M: can support the mouse to move the function of the cursor.

The correct way to shut down the machine

1. Who View who is online

2. Netstat–a View the online status of the network

3. Ps–sux viewing the background execution of the program

4. Sync writes data to the drive's instructions

5, Shutdown shutdown instructions

6, reboot, halt, Poweroff restart.

Toggle Execution Level: Init

#Linux共有七种执行等级.

#run Level 0: Shutdown

#run Level 3: Plain text mode

#run Level 5: Graphics interface mode included

#run Level 6: Restart

Linux file permissions and directory configuration Chgrp

Change the group that the file belongs to

Command Chgrpgroupname Install.log

chmod

Change the permissions of a file

1. Change owners and groups with chmod, Chmoduser.group file or Chmoduser:group file

2. chmod xyz file or directory

3. chmod (u/g/o/a) (+/-/=) (r/w/x) file or directory

Mkdir

mkdir [-MP] Directory name

-M: Configure file Permissions! Direct settings, do not need to see the default permissions of the face.

-P: help you to directly set up the desired directory (including the upper directory) recursively!

RmDir

rmdir [-p] Directory name

-P: Deleted along with the upper empty directory

Cp

CP [-ADFILPRSU] source file (source) destination file (destination)

Options and Parameters:

-A: equivalent to the meaning of –pdr, as for PDR please refer to the following instructions;

-D: If the source file is the attribute of the linked file, the link file property is copied instead of the file itself;

-F: For force, if the target file already exists and cannot be opened, then try again after removing it;

-I: If the target file already exists, the action will be asked before overwriting

-L: Connection file for hard connect (hand link) is established, not copy file itself

-P: Copy the past with the attributes of the archive, rather than using the default properties;

-R: Recursive continuous Replication for directory replication behavior

-S: Copy as a symbolic link file (symbolic link), i.e. "shortcut" profile

-U: Update destination! If destination is older than source

Rm

Remove a file or directory

RM [-fir] File or directory

-F: The meaning of force, ignoring the non-existent file, no warning message will appear;

-I: Interactive mode that asks the user whether or not to move before deleting

-R: Recursive delete Ah! Most commonly used in directories are deleted!

Mv

Move files and directories, or rename

MV [-FIU] source destination

-f:force mandatory Meaning, if the target file already exists, will not ask and directly overwrite

-I: If the target file (destination) already exists, you will be asked to overwrite

-U: If the target file already exists and the source is newer, it will be updated (update)

Touch

Create an empty file.

Revise an archive date to the current

Touch [-ACDMT] Profile

-A: Revise access time only

-C: Only the time to revise the file, if the file does not exist, do not create a new file

-D: You can follow the date you want to revise instead of the current date, or you can use the –date= "date or time"

-M: Modify Mtime only

-T: The time after which the revision can be received without the current time

Whereis

Search for specific files (search in database files, do not search for hard drives)

Whereis [-BMSU] file or directory name

-B: Only binary format files are found

-M: Find only files under the manual path of the description file

-S: Find source files only

-U: Search for other files not on the appeal three items

Locate

Locate [-ir] keyword

-I: Ignore case differences

-R: Can be followed by the normal representation of the display mode

Compress files

*. Z Compress Program Compressed archives

*.GZ GZIP Program Compressed archives

*.BZ2 BZIP2 Program Compressed archives

*.tar Tar program packed archives, and no compression

*.tar.gz Tar program packed archives, and gzip compressed

*.TAR.BZ2 tar program packaged files, which are compressed by bzip2

Tar

1. Compression: Tar–jcv–f filename.tar.bz2 The name of the file or directory to be compressed

2, inquiry: Tar–jtv–f filename.tar.bz2

3, Decompression: Tar–jxv–f filename.tar.bz2–c to unzip the directory

Dump

Dump is a powerful feature, and he can make a grade in addition to backing up the entire file system.

Vim Program Editor Delete

Copy

YY the line where the cursor is copied;

Nyy N is the number, where the cursor is copied down n rows;

Paste

Recovery and repetition

Insert or replace

Store and leave

Changes to the VIM environment

Block selection

Multi-file editing

Multi-window

Recognize and learn Bash

The shell used by Linux is called the "Bourneagain Shell", or bash.

command editing capability (history)

You can find the previous input instruction by pressing the up and down keys in the instruction column. So many instructions are recorded in the. bash_history inside the home directory.

Put it inside the/root/.bash_history.

command and file completion function ([tab] key) Command alias setting function (alias)

Example: Alias lm= ' Ls-al '

The back of the lm= ' ls-al ' cannot have spaces, to be joined together.

wildcard character (Wildcard) Bash Shell built-in command: type

The view commands are from external commands or built-in bash.

Export

To change the custom variable into an environment variable

Language variables (locale) that affect display results declare/typeset

Declaring the type of a variable

#declare [-AIXR] Variable

-A: Defines an array type for a variable that is later named variable

-I: Defines a variable with the following name variable as an integer numeric type

-X: Using the same as export, it is to turn the back variable into an environment variable

-r: Sets the variable to the readonly type, the variable cannot be changed, and cannot be unset

Formal notation and file format processing grep

Usage: grep [options] ... mode [file] ...

Find the style or standard input in each file.

The default pattern is a basic regular expression (BRE).

Example: Grep–i ' Hello ' menu.h main.c

Selection and interpretation of regular expressions:

-E,--extended-regexp pattern is an extended regular expression (ERE)

-F,--fixed-strings pattern is a new set of row separation repair strings

-G,--basic-regexp pattern is a basic regular expression (BRE)

-P,--perl-regexp pattern is a Perl regular expression

-e,--Regexp=pattern use PATTERN to match

-F,--file=file from file to get PATTERN

-I,--ignore-case ignoring case

-W,--Word-regexp forcing PATTERN to match only the entire word

-X,--line-regexp Force PATTERN to match only the entire row

-Z,--null-data ends with 0 bytes instead of a new line character data row

Miscellaneous:

-S,--no-messages do not display error messages

-V,--invert-match Select rows that do not match

-V,--Version prints the release information and exits

--help Show this Help and exit

--mmap if possible, use memory image as input

Output control:

-M,--max-count=num stop after having NUM matches

-B,--byte-offset print byte shifts at the same time as the output line

-N,--line-number The number of rows printed at the same time as the output line

--line-buffered Flush Outputon Every line

-H,--with-filename print the filenamefor each match

-H,--no-filename suppress theprefixing filename on output

--label=label print Labelas filename for standard input

-O,--only-matching Show only the partof a line matching PATTERN

-Q,--Quiet,--silent suppress all Normaloutput

--binary-files=type assume thatbinary files are TYPE;

TYPE is ' binary ', ' text ', or ' without-match '

-a,--text equivalent to--binary-files=text

-I equates to--binary-files=without-match

-D,--directories=action how to handledirectories;

ACTION is ' read ', ' recurse ', or ' skip '

-D,--devices=action How to Handledevices, FIFOs and sockets;

ACTION is ' read ' or ' Skip '

-r,-r,--recursive equivalent to--directories=recurse

--include=file_pattern only search for files that conform to the File_pattern style

--exclude=file_pattern skips a file or directory named File_pattern

--exclude-from=file Skip filesmatching Any file pattern from file

--exclude-dir=pattern directories that match PATTERN would be skipped.

-L,--files-without-match Print only names of files containing no match

-L,--files-with-matches print only names offiles containing matches

-C,--Count print only a countof matching lines per FILE

-T,--initial-tab make tabs line up (if needed)

-Z,--null file name after printing 0 bytes

Context Control:

-B,--before-context=num print NUM lines above

-A,--after-context=num print NUM line context

-C,--context=num print NUM Line output context

-num is the same as--context=num

--color[=when],

--colour[=when] Use tags to highlight matching strings;

When desirable value is "always", "Never" or "auto"

-U,--binary does not remove the CR character at EOL (MSDOS)

-U,--unix-byte-offsets If the CR is not there (MSDOS), report the offset value

' Egrep ' and ' grep-e ' mean the same. The meaning of ' fgrep ' is consistent with ' grep-f '.

Direct calls to ' egrep ' and ' fgrep ' have been discarded.

No file or file is-read standard input. If less than two FILE,

Suppose-H. If any row is selected, the exit status is 0;

If any errors occur and-Q is not given, the exit status is 2.

If you want to see a line that does not have a character, use the reverse selection [^] to implement it.

To view the beginning of the:

#grep ' ^the ' a.txt

The symbol ' ^ ' is different within and outside [], in [] means the reverse selection, outside [] means positioning at the beginning of the line.

Search for Blank lines,

#grep ' ^$ ' a.txt

(decimal point). The representative must have an arbitrary character meaning

(Star) * Represents the repetition of the previous 0 to infinite number of meanings, for the combined form

Qualifying consecutive character ranges {}

Shell Script

1, the execution of the instruction is from the top down, from the left and right analysis and execution

2, the instruction of the release: instructions, options and parameters of a number of white space will be ignored

3, blank lines will also be ignored, and the [tab] button pushed the blank space is also treated as a space key

4. If you read a enter sign (CR), try to start executing the line command

5. If there is too much content on one line, you can use "\enter" to extend to the next line

6, "#" can be used as annotations, any data appended to the # will be ignored as comment text

After the SH sh01.sh and./sh01.sh are executed, the variables within the subroutine will end without being passed back to the parent program.

After the source sh01.sh executes, the variables within the subroutine are passed back to the parent program.

Learning notes for basic Linux learning

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.