Linux operation and maintenance foundation 2


Content summary

  • Explanation of key configuration terms of virtual machine
  • Remote link tool
  • Xshell basic use
  • Linux command guidelines
  • System operation command
  • Common shortcuts
  • File command operation
  • File editing commands

Content details

Explanation of key configuration terms of virtual machine

#Virtual network editor description
  Bridge mode # can access the Internet
      The configured address information is the same as the address information of the physical host network segment, which is easy to cause address conflict
  Nat mode # can access the Internet
      The configured address information is different from the address information of the physical host network segment, which cannot cause address conflicts
  Host only mode # no internet access
      The address acquisition is mainly used for communication between virtual machine hosts, but cannot access the external Internet

    Similar to customs

#System partition
    /boot swap /
    "" "1. General partition scheme" ""
    /Boot boot partition save and system boot related files
    Swap swap partition temporarily turns the excess capacity of the hard disk into memory
        Memory <8g swap partition size ==1.5 times memory capacity
    /The remaining capacity of the root partition is equivalent to the C disk
    "" "2. Important data scenarios" ""
    /boot  200M
    Swap 1g 2G 1.5x
    /      20G-200G
    /Data remaining space
    "" "3. Flexible partition scheme" ""
    /boot 	200M
    swap  	 1g 2G 1.5x
    / 		20G-200G
    The remaining space is not divided

Remote link tool

Servers are usually in the computer room. We can't run to the computer room if we have nothing to do
Therefore, with the help of remote link tools, remote management and maintenance can reduce work pressure
SecureCRT paid version (cracked version is risky)
Xshell (recommended) free version
Putty has no function and can only meet remote links
Group file xshell5 comes with its own cracking code

Xshell basic use

Linux command guidelines

1. Check step by step
2. Commands in Linux are case sensitive
3. Commands are generally completed automatically (TAB key)
4. Many commands in Linux have no results after execution, which is often the best result
5. When filling in the file path, try not to write it yourself and use the tab to complete it

System operation command

Shutdown command shutdown
    Shutdown -h 10 # specify the number of minutes after shutdown
    Shutdown -c # cancel shutdown scheme
    Shutdown -h 0/now \

Restart command shutdown
    Shutdown -r 10 # specify the number of minutes to restart
    Shutdown -r 0/now # indicates immediate restart
    Shutdown -c # cancel the restart scheme

Common shortcuts

01. display historical input command information
    Use the direction keys to go up and down
02. Clear all screen information output
    ctrl + l  # clear
03. interrupt the execution process of cancel command
    CTRL + C # cancel cancel
04. quickly move the cursor to the beginning of the line
    ctrl + a
05. Quickly move the cursor to the end of the line
    ctrl + e
06. Delete (cut) the information from the cursor position to the beginning of the line
    ctrl + u
    Delete (cut) the information from the cursor position to the end of ⾏
    ctrl + k 
07. Paste the cut content back
    ctrl + y
08. Lock system window information status
    ctrl + s 
09. System command completion shortcut
10. Quickly move the cursor in the command
    CTRL + direction keys (move the cursor according to English words)

File command operation

Emphasis: in Linux system, try not to input the symbol information (command ⾏) in ⼊
1) How to create piece information
2) How to check whether a piece or record exists
 ls # list
 Display details of ⽂ pieces / ⽬ recording data
 Ls -l a.txt # can be abbreviated as ll a.txt
 Sort: find ⽂ pieces by ⽇ period
 ls -lt a.txt
 ls -ltr a.txt
3) How to view ⽂ piece information
 cat oldboy. txt oldgirl. txt > olddog. Txt # integration
4) Generate data information in empty parts 
 Echo # input and output information
 Echo Hello world # is equivalent to print ('Hello world')
 echo hello world > /oldgirl/oldgirl. Txt # w mode
 echo baby. com >> /oldgirl/oldgirl. Txt # append mode
Write ⼊
5) Copy (copy) documents or recorded data information
 cp # copy
 Syntax format: CP parameter information to enter ⾏ where to copy the copied information
 #Copy the /etc/hosts ⽂ file to the /oldboy ⽬
 cp /etc/hosts /oldboy/
 If you do not add slashes and Oldboy is meaningless, it will be copied to the root and renamed
 #How to copy overall recording data
 cp -r /etc/sysconfig/ /oldboy/oldgirl/
 #Duplicate copy to avoid prompt message
 \cp -r /etc/sysconfig/ /oldboy/oldgirl/
 '''cp core ⼼ function: backup data information '' '
 cp oldboy.txt oldboy.txt.bak
 cp oldboy.txt.bak oldboy.txt
Common problems:
 When copying ⽂ pieces, do not add / ⼀ after the ⽂ piece name. Generally, only y after ⾯ recording ⾯/
 ⽂ if the piece does not exist, it will be copied directly. If it already exists, you will be prompted whether to overwrite it
 cp -a
 -a == -d + -r + -p
 -D is related to link ⽂ pieces
 -R-entry ⾏ recursive replication
 -P keep attributes unchanged 
6) Cut (move) pieces or recorded data information
 mv # move
 MV parameter: where to move the data information
 Eg: move /etc/selinux/config to /oldboy/shanghai/
 1. First verify whether there is a corresponding record, then create it first
 2. Cut after confirming the error
 mv /etc/selinux/config /oldboy/shanghai/
 3. MV operation is sometimes dangerous, and errors may occur for nuclear parts removal
 mv /oldboy/shanghai/config /etc/selinux/
 You can also rename MV hosts hosts01 for a single piece
7) Data deletion command
 rm # remove
⽂ this editing command
 RM parameter data information to delete
 #Delete hosts01 in Oldboy ⽬ record
 rm hosts01
 #Delete ⽬ record operation
 RM shanghai/ error reporting
 RM -r shanghai/ correct
 #How to forcibly delete data information
 rm -f olddog. Txt no prompt
 RM -rf Jason does not prompt
'' RM operation is best to switch to the location of the target data and delete it. It is not recommended to make the absolute path ''

File editing commands

"" "the command of the system is VI, and VIM is easier to use" ""

VI ⽂ pieces of information you want to edit
#Operating steps for editing ⽂ pieces
 The ⼀ process: use the VI command to open the ⽂ file
 vi oldboy.txt
 The ⼆ process: enter the editing mode and start editing ⽂ pieces
 Press ⼩ write ⺟ I # insert on the keyboard
 The third process: editing
 The fourth process: exit editing mode
 Press ESC enter ⾏ exit
 The fifth process: close the open parts
 : WQ w-write q-quit save exit
VI quick ⽅
 :q!  Sometimes you have to add an exclamation point in VI editing mode to force entry and exit without saving
1. Quick cursor movement ⽅ type
 How to quickly move the cursor to the last ⼀⾏# ⼤ write ⺟ G
 How to quickly move the cursor to the ⼀ ⾏ # ⼩ write ⺟ GG
 How to quickly move the cursor to the middle to specify ⾏ # ⼩ write ҩ 10gg
 How to quickly move the cursor to the end of ⾏ symbol information shift+$
 How to quickly move the cursor to the ⾸ part of ⾸ digital information 0
2. Move the cursor to edit
 How to quickly move the cursor down ⼀⾏ and enter ⼊ editing status ⼩ writing ⺟ o
 How to quickly move the cursor to the end of ⾏ and enter ⾏ edit ⼤ write 𝑿 a
 How to quickly delete all information from the cursor position to the end and enter the editing state
#⼤ writing 𝈧 C
 How to clear all the current content information and enter the editing status CC
3. Quickly edit ⽂ this content information
 How to copy ⽂ this information ⼩ write ⺟ YY
 How to copy multiple information 3yy
 How to paste ⽂ this information ⼩ write ⺟ p
 How to paste multiple information 3P
 How to delete ⽂ this information ⼩ write ⺟ DD is actually the specified ⾏ information into ⾏
 How to delete multiple information 3dd
 Delete the word DG from the cursor to the end
4. Special operation ⽂ this content ⽅ type
 How to display ⽂ this ⾏ number information / how to cancel ⾏ number: set nu/: set nonu
 How to undo editing information ⼩ writing ⺟ u undo
 How to cancel an undo operation Ctrl + R redo
 Quickly search ⽂ pieces of information / content to be searched
 Press n to find the next match Shift + n the last match
5. Batch operation ⽂ this content
 Batch delete operation
 Step ⼀ move the cursor to the corresponding position 
 Step ⼆ enter the batch editing mode (view block mode)
 ctrl + v
 Step 3: select multiple ⾏ information
 ⽅ direction key selected
 Step 4: enter ⾏ delete
 ⼩ write D or X (delete the content selected by the cursor)
 Batch add operation (VIM)
 VIM needs to be installed:
 yum install vim tree bash-completion -y

Recommended Today

Knowledge Graph Reasoning for Joint Semantic and Data-Driven Path Representation

original Joint semantics and data-driven path representation for knowledge graph reasoning publishing Neurocomputing Volume 483 Issue C Apr 2022 pp 249–261 declare The copyright belongs to the original author and the publisher. If there is any infringement, please contact to delete Summary Reasoning on large-scale knowledge graphs is of great significance for applications such […]