install linux operating system

Install the Linux operating system

 

1. red had linux version

 

Red Hat Enterprise Edition:  Red Hat Enterprise Linux (RHEL for short); official website: http://www.redhat.com

Fedora Community Edition : Community maintenance funded by Red Hat, positioned for personal desktop use; official website: http://fedoraproject.org

CentOS Community Edition : Community Enterprise Operating System official website: http://www.centos.org

 

2. File system type

The file system type currently used by RHEL6 by default : EXT4, the fourth generation extended (Extended) file system

; SWAP, swap file system

Other file system types supported by Linux : FAT16, FAT32, NTFS; XFS, JFS

 

3. Initialization and boot process

       

 

 4. init process

The Linux kernel loads and runs the /sbin/init program: it is the first process in the system; the PID (process mark) number is always 1

 

5.Upstart startup method

inittab configuration file : scattered storage of various initialization configurations; corresponding related startup events

Partial upstart startup configuration file table

parameter

illustrate

/etc/inittab

Configure the default runlevel

/etc/sysconfig/init

Control the number of tty terminals opened and the terminal color scheme

/etc/init/rcS.conf

Load the rc.sysinit script to complete the system initialization task

/etc/init/rc.conf

Compatible script, responsible for call processing at each run level

/etc/init/rcS-sulogin.conf

Start the /sbin/sushell environment for single-user mode

/etc/init/control-alt-delete.conf

Ctrl+Alt+Del hotkey operation under the control terminal

/etc/init/start-ttys.conf

Configure the number of open tty terminals and device files

/etc/init/tty.conf

Control the opening of the tty terminal

 

6. Structure of the inittab file

View the init program configuration: cat /etc/inittab

Syntax: id:runlevels:action :process

field

illustrate

id

Used to uniquely identify a configuration record in the inittab file

runlevels

Used to specify in which runlevels this record runs

action

Used to describe what type of action the record will perform

process

Used to set the command executed by the startup process

runlevels - run levels

runlevel

illustrate

0

Shutdown state, using this level will shut down the host

1

Single-user mode, you can log in to the system without password authentication, mostly used for system maintenance

2

Multi-user mode with character interface (does not support network access)

3

Full multi-user mode with character interface, most server hosts run at this level

4

Not allocated for use

5

The multi-user mode of the graphical interface provides a graphical desktop operating environment

6

Reboot, using this level will reboot the host

Note: Only the default runlevel configuration is kept in the /etc/inittab file of RHEL6

 

7. System service control

Syntax: service service name control type or /etc/rc.d/init.d service name control type

Control type: start: start; stop: stop; restart: restart; reload: reload status: view service status

Use the service tool or the system service script in the /etc/init.d directory to start, restart, and stop system services

 

8. Runlevels

View: Use the runlevel command to display: the run level before the switch, the current run level

Temporary switch: use init command with 0-6 runlevel parameters

[root@localhost ~]# runlevel

5 3

[root@localhost ~]# init 6 (reboot system)

[root@localhost ~]# init 0 (shut down the system)

 

9. Optimize the startup process

ntsysv tool: Provides an interactive, visual window; can be run on a character terminal; facilitates centralized management of multiple services

Syntax: ntsysv; ntsysv --level level list

chkconfig tool: similar to the ntsysv tool but does not provide an interactive, visual window; it is more efficient to manage a single service

 

10. Startup and control of system services

 Check the startup status of system services

Syntax: chkconfig –list View the default startup status of all services

chkconfig --list service name View the default startup status of the specified service

Set the startup status of system services

Syntax: chkconfig --level level list service name on|off

 

Directory and File Management

 

1. Classification of Linux commands

Purpose: An instruction or program used to implement a certain type of function; the execution of the command depends on the interpreter program (for example: /bin/bash)

Classification

Internal command: part of the shell interpreter

External commands: program files independent of the shell interpreter

 

2. Format of Linux commands

Syntax: command word [options] [parameters]

Options: Used to adjust the specific function of the command

Short format options (single characters) are preceded by "-", e.g. "-l"

Leading long format options (multiple characters) with "--", e.g. "--color"

Multiple short-form options can be written together, only preceded by a "-", e.g. "-al"

Parameters: The object of the command operation, such as file, directory name, etc.

Several auxiliary operations of command line editing

Tab key: auto-completion

Backslash "\": Force newline

Shortcut Ctrl+U: Clear to the beginning of the line

Shortcut Ctrl+K: Clear to end of line

Shortcut Ctrl+L: Clear the screen

Shortcut Ctrl+C: Cancel the editing of this command

 

3. Basic commands

1 ): cat command : display the content of the file

Syntax: cat [options] filename...

2 ): more command/less command : paging display file content in full screen mode

Syntax: more/less [options] filename…

Interactive operation method: press Enter to scroll down line by line; press space bar to scroll down one screen; press q to exit/Page Up to page up, Page Down to page down; press "/" to find content, "n" "The next content, "N" the previous content; other functions are basically similar to the more command

3 ): head command/tail command: view part of the beginning/end of the file (default is 10 lines)

Syntax: head /tail -n filename…

4 ): wc command: count the number of words in the file (Word Count). The number of lines and other information

Syntax: wc [options]... object file...

Common command options : -l: count lines; -w: count words; -c: count bytes

E.g.[root@localhost ~]# wc /etc/hosts

4 23 185 /etc/hosts ( 4 lines, 23 words, 185 bytes )

5 ): grep command : find and display lines in a file that contain the specified string

Syntax: grep [options]... Find conditional object files

Common command options: -i: ignore case when searching (ignore case); -v: reverse the search (invert), output lines that do not match the search conditions

Search condition setting: the string to be searched is enclosed in double quotation marks; "^..." means start with..., "...$" means end with...; "^$" means blank line

6 ): gzip command, bzip2 command: make compressed files, unzip compressed files

Syntax: gzip [-9] filename...

bzip2 [-9] filename... (makes compressed file)

 gzip -d compressed file in .gz format

  bzip2 -d compressed file in .bz2 format (uncompressed file)

Common command options: -9: indicates a high compression ratio, which is mostly used when creating compressed packages; -d: used to unzip already compressed files

Note: The compression algorithms used by the gzip and bzip2 commands are different . Generally speaking , the compression efficiency of bzip2 is better.

8 ): tar command : make archive files, release archive files

Syntax:   tar [options] ... archive filename source file or directory

tar [options]...archive_filename [-C target_dir]

Common command options:

-c: Create a package file in .tar format

-x: Unpack the package file in .tar format

-v: output verbose information

-f: indicates use of archive files

-p: preserve the permissions of the original files and directories when packaging

-t: List view files in the package

-C: Specify the target folder to be released when unpacking

-z: call the gzip program to compress or decompress

-j: call the bzip2 program to compress or decompress

 

4. Text editor

There are many configuration files in Linux, similar to the registry in windows; the default is managed and maintained by the vi editor (text editing tool); vim is an enhanced version.

Three working modes: command mode, input mode, last line mode

Switch between different modes

 

 

Basic command operations

Operation type

Action keys

Function

Mode switch

a

Insert content after the current cursor position

 

i

Insert content before the current cursor position

 

o / O

Insert a new line after/before the current cursor line

Cursor movement direction

á 、 â 、 ß 、 à

up down left right

Quick jump in line

line number display

Home key or "^"/End key or "$"

: set nu /: set nonu

Jump to beginning/end of line

Display line number/cancel line number display

delete

x or Del

Delete a single character at the cursor

 

dd

delete the current cursor line

 

#dd

Delete the #line content starting at the cursor

 

d^

Delete all characters from the current cursor to the beginning of the line

 

d$

Delete all characters from the current cursor to the end of the line

copy

yy

Copy the entire content of the current line to the clipboard

 

#yy

Copy the contents of the #line starting at the cursor

paste

P (large)

before pasting at the cursor position

 

p

Paste the contents of the buffer after the cursor position

save and exit

:wq

Save changes and exit

quit

:q!

Abandon the modified file and exit

Save as

:w /root/newfile

Save as…

Find file contents

/word /?word

Find the string "word" from top to bottom/bottom to top

 

n/N

locate the next/previous matching string to be searched for

Undo edit

u

Press once to cancel the most recent action, and so on

 

U

Used to cancel all edits made to the current line

save and exit

ZZ

Save the current file contents and exit the vi editor

Open new file

:e ~/install.log

Open a new file for editing

read other content

:r /etc/filesystems

Read the contents of other files in the current file

file content replacement

:s /old/new

Replace the first "old" found with "new"

 

:s /old/new/g

Replace all "old" found with "new"

 

:#,# s/old/new/g

Replace all "old" with "new" in the range "#,#"

 

:% s/old/new/g

Replace all "old" with "new" throughout the file

 

:s /old/new/c

Add the c command at the end of the replacement command to prompt for confirmation

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325232160&siteId=291194637