Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Use the vi text editor and copy and paste Linux tips     - Bash job control (Linux)

- Four levels to deal with Linux server attacks (Linux)

- Some common Linux commands Study Notes (Linux)

- Binary tree traversal: the first sequence in order preorder recursive and non-recursive and traversal sequence (Programming)

- Learn to read the source code of vmstat (Linux)

- Ubuntu 15.04 and Ubuntu 14.04 installed Cinnamon 2.6 (Linux)

- Linux server network penetration testing (Linux)

- Java deserialization test (Programming)

- NFS installation process under the CentOS (Linux)

- Ubuntu apt-mirror established local private sources (Linux)

- git checkout generated in the use of temporary br (Linux)

- Java implementation linear table - represents the order of representation and chain (Programming)

- Java data structures - order linear form of table ArrayList (Programming)

- MySQL In can not be overridden with an internal connection (Database)

- HBase table data processing tab (Database)

- How to deploy Icinga client (Server)

- Openfire Hazelcast cluster Detailed (Server)

- How to use the command line to obtain Freely RSS source on Linux (Linux)

- Ubuntu 14.04 / 14.10 how to install FFmpeg 2.5.1 (Linux)

- Fedora && Arch Linux - the most romantic thing to happen now (Linux)

 
         
  Use the vi text editor and copy and paste Linux tips
     
  Add Date : 2018-11-21      
         
         
         
  Want to be an efficient DBA, is inseparable from the skilled use vi editor, especially those planning to OCM exam and those who are more so. In addition, Linux system, the left mouse button to select the text, and then by holding the middle mouse scroll bar to paste functions are also required to master the tips. After I contacted Linux for seven years, but also by the technique a chance to ask questions and learned, this feature Linux upgrade at least 15% of my test speed. Test over again because people know not only the proficiency test, it is the efficiency and speed test.

Use the vi text editor

A profile is one of the salient features of Linux systems, and its role is somewhat similar to the Windows system registry, but the registry is centralized management, and configuration files using a free decentralized management. vi is a powerful full-screen text editor, vim is an enhanced version of the vi editor, based on the extension of the vi editor a lot of useful features, but also on customary vim called vi.

vi editor operating modes:

Command mode: After starting the vi editor to enter the command mode, which was completed for cursor movement, string search, as well as delete, copy, paste the contents of the file and other operations.

Input mode: This mode of operation is entered in the main contents of the file, the text file can modify or add new content. For input mode, the last line of the editor appears "--insert--" status message.

Line mode: This mode can be set to vi editing environment, save the file and exit the editor, and his daughter to find a file, replace such operations. For the last line mode, there will be the last line ":" prompt.

A, vi editor to open the file

vi (example: vi test.conf, vi /tmp/test.conf, ...)

If the presence of the specified filePathAndName will automatically load the file contents, and if not it will be created automatically. Note: before each line shows the tilde indicates that this row is empty.

Second, the mode switching: in command mode, using a, A, i, I, o, O and other keys to quickly enter the input mode, press the Esc key to return to command mode. Enter on the command line mode mode Press ":" you can be.

Three, vi editor command

1, the screen flip

Ctrl + u: turn up half screen

Ctrl + f: turn up one screen

Ctrl + d: scroll down half screen

Ctrl + b: scroll down one screen

2. Move the cursor command

Commonly used to move the cursor arrow keys, consider compatibility issues, vi define the direction of too much instruction, the following is just a small part (commonly several):

space: the cursor right one character

Backspace: the cursor left one character

Enter: cursor down one line

nG: move the cursor to the first line n

n +: the cursor down n lines

n-: n Move the cursor on the line

n $: move the cursor to the end of the n-th row

0: move the cursor to beginning of current line

$: Move the cursor to the end of the current line

3, insert or delete command

Common insert, delete command is as follows:

i: to insert before the current cursor after the text cursor moves back

a: from the current cursor inserted, after the text cursor

I: In the first line where the cursor is inserted (before the first non-blank character)

A: From the end of the line where the cursor is inserted

o: Add a new line at the cursor below the line (and the input mode)

O: a new row above the cursor line (and the input mode)

x: Delete the character where the cursor is equivalent to [Delete] function key

X: remove the character before the cursor, comparable to [Backspace]

dd: delete the row cursor

yy: copy the contents of the current line is the line to the clipboard

#yy: # is the specific figures, it can be copied from the cursor at the beginning of the line # content

After pasting the clipboard contents to the current cursor position: p

Before paste the clipboard contents to the current cursor position: P

r: Modify the character where the cursor

R: Replace the current character and the subsequent character until you press [ESC]

s: starting from the current cursor position to input the text alternative specified number of characters

S: delete the specified number of rows, and enter the text replaced by the

do: to delete the line

d $: Delete to end of line

Four, vi locate, save and exit

Exit the input mode, first click the [ESC] key (sometimes more than double-click), and then executed:

Press / - Enter the specified string, look down from the current cursor position.

Press the key -? Enter the specified string, look up from the current cursor position.

Find End Press n, N key to select a different search results.

Press u-- cancel the last operation can be repeated, similar revoked.

Press U-- cancel all the edits made to the current line. : W - save the current file

: Wq - save and exit (with the instruction: x the same function)

: Q - exit, as modified will be prompted to save

:! Q - quit without saving

Fifth, open a new file or read the contents of other documents

In the current vi editor, execute ": e new file" in the form of the last line command to edit the new file.

In the current vi editor, execute ": r other documents" in the form of the last line command reads the contents of other files, copy it to the current cursor location.

In the current vi editor, do ":! R Command" in the form of Mo-line mode, the output of other commands can be stuck to the cursor location in the text file.

Executed in line mode "set number" command to display the line number, the implementation of "set nonu" Cancel display line numbers.

Six, vim editor useful parameter

-o file1 file2; will open two files, display up and down, use ctrl + w to switch files.

-O File1 file2; will open two files, display around, use ctrl + ww handover file.

Seven, Find and Replace
? / N N
 : S / old / new /
 : N, M s / old / new /
 :% S / old / new / g% of all global line g

Save
: N, M w file.txt

V Visual mode
 d delete y Copy

Eight, profile location

/ Etc / vimrc

Let vimtutor command displays normal
cd / usr / share / vim / vim72 / tutor
 mv tutor.zh.euc tutor.zh.euc.bak
 iconv -f GBK -t utf-8 tutor.zh.euc.bak -o tutor.zh.euc
 vimtutor
     
         
         
         
  More:      
 
- jobs command example (Linux)
- A custom implementation of the Android sidebar (Programming)
- C ++ How to determine the types of constants (Programming)
- Linux system installation Gitlab (Server)
- Swift notes - let you two hours to learn Swift (Programming)
- CentOS 6.5 platform offline compile and install PHP5.6.6 (Server)
- DRBD + Heartbeat solve NFS single point of failure (Server)
- Getting Started with Linux system to learn: how to check the version of SSH on Linux (Linux)
- Detailed steps - GAMIT solver (Linux)
- Fast Learning Clojure (Programming)
- CentOS7 installed MySQL (Database)
- Linux Getting Started tutorial: hard disk partition and to deal with traps (Linux)
- RedHat Linux 5.5 installation process SVN Service Notes (Server)
- Debian 8 Jessie install LAMP server tutorial (Server)
- pdf.js Tutorial (Linux)
- Use netcat [nc] command on Linux and Unix port scan (Server)
- RedHat 6 xrdp use remote login interface (Linux)
- Introduction and use of the Raspberry Pi (Linux)
- Bash environment is automatically install and initialize oh-my-zsh & autojump zsh (Linux)
- File permissions under Linux (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.