liunx the vi editor shortcuts

  1. Operating system shortcuts
    1) using the arrow keys ↑ ↓ --- fast retrieval of historical command (command input will be temporarily stored in memory -> Save the file to disk)
    2) move the cursor quickly
    ctrl + a --- Move the cursor fast move to the beginning of the line
    ctrl + e --- quickly move the cursor to the end of the line
    ctrl + ← → --- the cursor left move as fast word
    3) fast operation command information
    ctrl + u --- the content before the cursor cut
    ctrl + k --- contents after the cursor shear
    ctrl + w --- shear each separated by a space character string information as
    ctrl + y --- paste the contents of the cut
    4) special function shortcut
    ctrl + c (cancel) --- interrupt or cancel the command execution process
    ctrl + l (clear) --- clear screen operation
    ctrl + s --- into the locked state
    ctrl + q --- exit the locked state
  2. Use editing commands VI / Vim
    . 1) Edit Mode command information
    command mode: special functions in the operation
    edit mode: editing the file contents information
    line mode: special command can enter information wq q wq q!!

    Command mode -i-> Edit mode -esc-> Command Mode
    Command Mode -: -> line mode -esc-> command mode

    2) Command mode ---> Edit Mode
    I --- at the cursor location directly into the editing mode
    I --- move the cursor to the beginning of the line to enter the edit mode
    A --- a character enters edit mode at the cursor position
    A --- end of the line the cursor is switched to enter the edit mode
    O --- inserted below the cursor line a new line, and enter the edit mode
    O --- insert a new row in the row above the cursor, and enter the edit mode
    s --- delete the character at the cursor position and enter edit mode
    S --- delete the cursor line and enter edit mode oh

    3) Command Mode ---> bottom line mode
    : --- entering in the end-line mode, complete functional operation q WQ WQ WQ!!
    / --- Search File information n N look up look down
    --- Search File information? n look up N lookup down
    PS: ignore case lookup data file
    / Oldboy \ C
    . 4) how to quickly move the cursor (command mode)
    G --- switch to the last line
    GG --- a first switch to a file line
    100G --- switch to the file specified line
    100gg
    ^ --- switch to the beginning of a line
    $ --- switch to the end of a line

    5) how to do special editing operation
    yy --- copy specified line information
    nyy --- copy multiple lines of information
    content p --- paste the copied at the specified line
    content np --- copy of the specified line in that sticks times
    dd --- delete the specified line information (in real terms is cut)
    NDD --- delete the specified multi-line message (the essence is the shear)
    dG --- all lines after deleting the contents of the cursor
    C --- delete the contents after cursor enter the edit state and
    R & lt replace the specified character information ---
    R & lt plurality of character information for successive replacement ---
    6) commands operation of the special function mode
    U --- withdrawal operations Use the undo
    Ctrl + R & lt canceled withdrawn redo ---

    Line mode special feature operation
    : set nu --- display line numbers
    : set nonu --- cancel the line number display
    error 04: error message is displayed, not the normal editing
    cause of the problem:
    1) When you edit a file, a sudden interruption
    2) file by multiple users to simultaneously edit the

    Conduct problem solving:
    problem: Solution
    First course: recover data before the interruption information
    vi -r edit file information
    Second course: delete a hidden file
    Description:. Linux file system to start is the hidden files
    using the ls -a view hidden files
    rm -f /oldboy/oldboy.txt.swp

  3. Editing commands Common Errors
    Error 01: editing commands can only edit the file
    Error 02: You must specify the file you want to edit
    error 03: Edit the file directory must exist
    Error 04: error message is displayed, not the normal editing
    analyze cause of the problem:
    1) Edit the file, there is a sudden interruption
    2) file by multiple users to simultaneously edit the

    Conduct problem solving:
    problem: Solution
    First course: recover data before the interruption information
    vi -r edit file information
    Second course: delete a hidden file
    Description:. Linux file system to start is the hidden files
    using the ls -a view hidden files
    rm -f /oldboy/oldboy.txt.swp

    vi command execution principles
    1) Edit the file will have a hidden file
    2) is directly edit content in a hidden file
    3) When you save the file is a hidden file rename operation
    directory structure linux system / directory information
    PS: the system all the data are file
    boot --- hold a boot system boot file system similar to windows c: / windows
    etc --- system services configuration file directory
    opt / usr --- save the third software program users install directory files program
    root --- system user's home directory super user's home (palace)
    home --- system user's home directory ordinary user's home (slums)
    var --- the system log file directory
    tmp --- temporarily store data directory is similar to windows recycle bin
    sbin --- binaries == binary command file Super
    bin --- binaries == command file binary
    dev --- ??????
    mnt --- ??????
    Media audio video store --- picture
    SYS / proc --- ???
    lib --- library adjusted sauces development code requires the use of the library you want to save the file directory 32 program library files
    needed to lib64 --- library 64-bit program library files
    directory level official data: HTTP: //www.p athname.com/fhs/pub/fhs-2.3.html

  4. Course knowledge summary carding
    1) command to get help information man command / --help help / builtin
    2) operating system shortcuts
    3) Edit command skills
    4) editing commands common errors
    5) operating system directory structure

Guess you like

Origin blog.51cto.com/14623872/2455135