linux 03 command Continued

 A, vim

    Two modes of operation: a new file

pyvip @ Vip: ~ / demo / 2_3 $ vim demo.txt # operate a new file

    A command mode is entered, press enter insert mode i, start editing content, press esc enter command mode, i / I, o / O, a / A is input in the command mode, the most commonly used is i

    Lower case i is inserted starting from the cursor position, a capital I is inserted starting from the first row

    A lower case is inserted from the back start position the cursor, uppercase A is inserted starting from the end of the line

    Lowercase o opens a row downwardly open up one line uppercase O

    Command line mode is also a mode

    The following operations are based on the command mode:

      1, the save operation

: q # quit, if the content is changed, no exit 
:! q # forced to quit without saving changes 
: w # Save changes 
: wq # Save and exit 
: x # save and exit

      2, common operations

 
# Usually lowercase and uppercase letters function is the opposite

<! - Copy -> YY # Copy line (n) yy # copy multiple lines eg: 6yy copy 6 lines y $ # copy the cursor to the end of the line (including the cursor) the y-^ # copy cursor up to the beginning of the line (not including the cursor ) <-! - paste> P # paste <! - cut / delete -> dd cut # / remove a line (n) dd # cut / delete lines eg: 6dd cut / deleted rows 6 d $ # cut / delete the cursor to the end of the line (including the cursor) d ^ # cut / delete cursor up to the beginning of the line (not including cursor and spaces) d # cut / delete the cursor to the end of the line (including the cursor) D0 # cut / delete cursor up to the beginning of the line (including spaces but excluding cursor) the X-# delete the character under the cursor (later deleted) the X-# delete a character before the cursor (forward delete) <-! withdrawn -> U # withdrawal ctrl + r # anti-withdrawal # repeats the last operation. <! - modify -> R & lt modified cursor character # R # into the replacement state, a plurality of modified <! - after shifting the entire line -> >> # entire line moved back << # entire line moved forward <-! select a block of code -> v # start position from the cursor to select a plurality of rows V # multiple selections <- find and replace -!> :% S / str1 / g # str2 str1 with str2 replace the text /, j g added to replace all, without only replace the first : 12,20s / str1 / str2 / g # find str1 line 12 through line 20, and replaced with str2
 

      3, operation of the cursor

 
<-! - vertically and horizontally> 
H # left    
under j #   
a # K   
L # Right 

<! - page -> 
Ctrl + Down # D-half page 
ctrl + f # the next 
ctrl + u # up half page 
ctrl + b # Previous to the 

<! - fast positioning -> 
G # cursor quickly locate the last row 
gg # cursor quickly locate the first row     
H # quickly locate the cursor in the visible region of the first row   
M # quickly locate the cursor the visible region of the intermediate 
L # cursor quickly locate the last line in the visible region of 
<! - mobile -> 
0 # cursor jumps to the beginning of the line 
^ # cursor jumps to the first non-blank character in the first row 
$ # jump cursor end of the line to 
the first letter w # cursor to the next word 
b # move the cursor to the first letter of a word
 

Second, the authority

  1. Permissions

 
-rw-rw-r-- 1 pyvip pyvip 36 Feb 3 14:48 demo.py # 9 letters in the first column indicates the file or directory permissions; represents R & lt read, w for write, x denotes performed; second column represents the number of file hard links; third column indicates the file owner; fourth column shows the group the file belongs to; and the fifth column represents the file size, if it is a directory, the directory represents the size, note that the size of the directory itself, not the directory following its total file size; sixth column represents the file or directory was last modified 

-rw-rw-r-- # first - is represented by a file type, mainly rw-rw-r- in the back -, 9 put behind us, divided into three groups. A set of three; rw- first set representing the user's own permissions (User); a second set of expressed permission rw- user's group (group); r-- third group represented by other users permission (OTHER) 


R & lt # Indicates whether readable, if not r permission, is a directory, you can not go ls view, is a file, you can not go to cat View         

w # Indicates whether to write, if not w permission, is a directory, you can not go mkdir create a directory file, a file, you can not go touch to create a file         

x # indicates whether an executable, if there is no x permission, if the directory, you can not cd into it, and if a file can not be executed
 

  2, modify the permissions

    a, letter method

 
pyvip @ Vip: ~ / demo / 2_3 $ chomd u / g / o / a + / - / = rwx fileName / dirName # u / g / o / a user table, + / - / = table setting or subtraction, rwx table permissions, fileName / dirName filename 

    u ==> user # user permissions 
    g ==> group # group permission 
    o ==> other # other rights 
    a ==> all # All 

    + ==> # Add add permissions   
    - = => # removed out of permission 
    = ==> set permissions set #
 

    b, either digital

pyvip @ Vip: ~ / demo / 2_3 $ chmod 775 fileName / dirName # 7 represents a 4 + 2 + 1, has all privileges; 6 + 2 represents 4, only read and write privileges; represents a 4 + 1 5, and read only execute permissions; 3 represents only write and execute permissions; 0 means no rights; 775 in turn said he, group, and others permission to 

    r ==> the Read ==> 4 
    w ==> the write ==> 2 
    the X- ==> performed ==>. 1 
    - ==> no ==> 0

 

  

Guess you like

Origin www.cnblogs.com/sysun110/p/11267605.html