




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、linux文件编辑vi命令详解(Linux file editor VI command detailed)The VI editor is the standard editor for all Unix and Linux systems, and it is no less powerful than any of the latest text editors. Heres a brief introduction to how it works and a small portion of the instructions. Since the VI editor is identi
2、cal to any version of the Unix and Linux systems, you can learn more about it in any other place where VI is introduced. The most basic text editor is Vi Linux, learn it, you can run in both directions unblockedly Linux in the world.1, the basic concepts of VIBasically, VI can be divided into three
3、states, namely command mode (command, mode), mode mode (Insert mode) and last line mode, and the functions of each pattern are distinguished as follows:1) command line mode command mode)Control screen cursor movement, delete characters, words or rows, move, copy a section, and enter Insert mode, or
4、to last line mode.2) insert mode (Insert mode)Only in Insert mode can you do text input, press the ESC key to return to command line mode.3) bottom line mode (last line mode)Save or exit the VI, or you can set the edit environment, such as finding strings and listing the line numbers. Etc.But in gen
5、eral we use the simplified VI into two modes, is the bottom line mode (last line mode) on the command line command mode).2, the basic operation of VIA) enter VIAfter the system prompt symbol enters VI and file name, enter the VI full screen edit screen:$VI myfileBut one thing to pay special attentio
6、n to is that after you enter VI, you are in the mode (command), and you have to switch to Insert mode to enter the text. The first use of VI people will want to use the arrow keys to move the cursor, the computer has been called bleep, his mad, so after entering the VI, the first not to move into in
7、sert mode (Insert mode)!B) switch to insert mode (Insert mode) to edit the fileUnder the command line mode (command mode), press the letter I to enter Insert mode, then you can start typing.C) Insert switchingYou are currently in the Insert mode mode, and you can only enter the text all the time, if
8、 you find the wrong word! If you want to move back with the cursor keys, delete the word first, press the ESC key, go to command line mode (command mode), and then delete the text.D) quit VI and save the fileIn the command line mode (command mode), click : the colon key enters Last line mode, for ex
9、ample: W filename (enter W filename) save the article as the specified file name filename.): WQ (enter WQ, save and exit VI): q! (enter Q, do not save, force VI)3, command line mode (command mode) function keys1) insert modePress I to switch to insert mode insert mode, press I to enter the insert mo
10、de, then start the file from the current position of the cursor;When you press a to enter the insert mode, enter the text from the next position in the current cursor;According to the O into the insert mode, is to insert a new line, starting from the input text.2) switch from insert mode to command
11、line modePress the ESC key.3) move cursorVI can move directly up and down with the cursor on the keyboard, but the regular VI uses lowercase English letters H, J, K, L, respectively, to control the cursor, left, bottom, top and right.Press Ctrl + B: move the screen to the back.Press Ctrl + F: move t
12、he screen to the front.Press Ctrl + U: the screen moves back half.Press Ctrl + d: move the screen to the front half page.Press the number 0: move to the beginning of the article.Press G: move to the end of the article.According to the $: move to cursor at the end of the line.According to the : the m
13、ove to cursor Press W: the cursor jumps to the beginning of the next wordAccording to the e: the cursor to jump to the next word suffixPress B to return the cursor to the beginning of the wordAccording to the #l: the cursor to the line of the # position, such as: 5L, 56l.4) delete textX: each time t
14、he cursor is deleted, a character is removed from the cursors location.#x: for example, 6x means the 6 characters of the back of the cursor where the cursor is deleted.X: uppercase X, and each time the cursor is deleted, a character in front of the cursor is deleted.#X: for example, 20X means the 20
15、 characters in front of the cursor where the cursor is deleted.DD: deletes the cursors line.#dd: delete rows from the cursor to #5) copyYW: the cursor to where the suffix characters are copied to the buffer.#yw: copy # words to the bufferYY: copy the cursor line to the buffer.#yy: for example, 6yy m
16、eans copying 6 lines of text from the line in which the cursor is located.P: put the characters in the buffer to the cursors location. Note: all replication commands associated with Y must work with P to complete copy and paste functions.6) replaceR: replaces the character at the cursors location.R:
17、 replaces the character of the cursor wherever it goes, until the ESC button is pressed.7) reply to last operationU: if you execute a command by mistake, you can press u at once and return to the previous operation. By multiple u, you can perform multiple replies.8) changeCW: the word to change the
18、cursor at the endC#w: for example, c3w means changing 3 words9) jump to the specified rowCtrl + g lists the line number of the cursors line.For example: #G, 15G, said the cursor to the fifteenth line of the.4, Last, line, mode, command BriefBefore using the last line mode, remember to press the ESC
19、button to make sure that you are already under command mode, and then click colon to enter last line mode.A) list the line numbersSet Nu: when you enter set Nu, you will list the line numbers in each line of the file.B) jump to a line in the file#: # said a number, enter a number in the colon, then
20、press the Enter key to jump to the bank, such as digital input 15, then enter, will jump to the fifteenth line.C) lookup characters/ keyword: press the / key first, then type the characters you want to search. If the keyword you want for the first time is not what you want, you can always press n to
21、 find the key you want.Keyword: press the first button first, and then enter the characters you want to find. If the first search key is not what you want, you can always press n to find the keyword you want.D) save the fileW: you can save the file by entering the letter W in the colon.E) leave VIQ:
22、 press Q to quit. If you cant leave VI, you can force Q to leave VI with a !.QW: when you leave, it is generally recommended to be used with W so that you can save the file when you exit.5, VI command list1. The following table lists functions of some keys in command mode:HLeft shift cursor one char
23、acterLRight shift cursor one characterKcursor upJcursor downMove the cursor to the beginning of the lineZeroThe number 0 moves the cursor to the beginning of the articleGThe cursor moved to the end of the article$Move the cursor to the end of the lineCtrl+fFront screenCtrl+bBack flip screenCtrl+dMov
24、e the screenCtrl+uBack up the screenIInsert characters before cursor positionAAdded to the last character at the cursors locationOInsert a new line, began to enter from theESCReturns from the input state to the command stateXDelete the characters behind the cursor#xThe character after the cursor has
25、 been deletedX(capitalize X). Delete the characters in front of the cursor#XRemove the cursor in front of # charactersDDDelete the line where the cursor is located#ddDelete where the number of rows from the cursor for the #YWA word that copies the cursors location#ywCopy the current cursor position
26、# wordsYYA row that copies the cursors location#yyWhere the number of rows from the cursor to the copy for #PpasteUCancel operationCWA word that changes the location of the cursor#cwThe cursor changes the location of the # words2. The following table shows some instructions in the trip command modeW
27、 filenameSave the file being edited as filenameWQ filenameStore the file being edited as filename and exit VIQ!Drop all changes and exit VISet nuset numberOr /?Find what you want to search after / afterNUse with / or if the lookup is not a keyword you want to find, press n or backward (with / use) o
28、r forward (with), until you find it.For the first time with VI, there are a few points to note:1, after you open the file with VI, you are in the mode (command), and you have to switch to Insert mode to enter the text. Switch method: in the command line mode (command mode), click the letter I, you c
29、an enter the Insert mode model, then you can start typing.2, after editing, you need to switch from the insert mode to the command line mode to save the file. Switch method: press the ESC button.3, save and exit the file: enter WQ in command mode! (dont forget the front of WQ)VI manualVI is the most
30、 commonly used text editing tool on UNIX, and as a UNIX software tester, it is necessary to master it.The command to enter VIVI filename: open or create a new file, and place the cursor on the first lineVI +n filename: open the file, and place the cursor on the N lineVI + filename: open the file, an
31、d place the cursor on the last lineVI +/pattern filename: open the file and place the cursor at the first string that matches the patternVI -r filename: the last time VI was edited, a system crash occurred, restoring filenameVI filename.filename: open multiple files, and edit them in turnMove cursor
32、 class commandsH: the cursor moves one character to the leftL: the cursor moves to the right one characterSpace: the cursor moves to the right one characterBackspace: the cursor moves one character to the leftK or Ctrl+p: move the cursor up one lineJ or Ctrl+n: move the cursor down one lineEnter: mo
33、ve the cursor down one lineW or W: the cursor to the right one word to doB or B: the cursor to the left one word to doE or E: the cursor to the right one word to the j suffixCursor moved to the end of the sentence(cursor moved to the head of a sentence move the cursor to the beginning of the paragra
34、phcursor moved to end of paragraphNG: the N cursor to the beginningN+: cursor down n lineN-: move the cursor up n linesN$: the N cursor to the end of the lineH: cursor moves to the top line of the screenM: cursor moves to the middle of the screenL: cursor moves to the last line of the screen(Note: 0
35、 is the number zero) the cursor to the beginning of the current line$: the cursor to the end of the current lineScreen rollover class CommandCtrl+u: the first half turn to the fileCtrl+d: to the end of the file over the screenCtrl+f: flip a screen to the end of the fileCtrl + B; flip a screen to the
36、 top of the fileNZ: roll line n to the top of the screen and roll the current row to the top of the screen without specifying n.Insert text class CommandI: before the cursorI: at the beginning of the current lineA: after the cursorA: at the end of the current lineO: open a new line under the current
37、 lineO: new line on top of the current rowR: replace the current characterR: replaces the current character and its subsequent characters until the ESC key is pressedS: starting from the current cursor position, replacing the specified number of characters with the input textS: deletes the specified
38、 number of rows and replaces them with the input textNCW or nCW: modifies the specified number of wordsNCC: modifies the specified number of rowsDelete commandNDW or ndW: deletes the N-1 word at the beginning and after the cursorDo: to delete theD$: Delete to end of lineNDD: deletes the current row
39、and its subsequent n-1 rowsX or X: deletes a character, X deletes the cursor, and the X deletes the cursorCtrl+u: delete the text entered under the input modeSearch and replace command:/pattern: search pattern from the end of the cursor at the end of the filePattern: search for the pattern from the
40、cursor at the beginning of the fileN: repeat the last search command in the same directionN: repeat the last search command in the opposite direction: s/p1/p2/g: replace all P1 in the current line with P2: N1, n2s/p1/p2/g: all P1 in line N1 through N2 are replaced by P2: g/p1/s/p2/g: replace all the P1 in the file with P2Option settingAll: list all options settin
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 投资决策分析能力试题及答案
- 生物教师研修发言稿初中
- CFA考试失败原因与试题及答案
- 2024年CFA考试新规划试题及答案
- 量化风险模型的构建方法试题及答案
- CFA考试的五大关键领域试题及答案
- 汽车电气设备构造与维修 教案 王锡戎 项目7、8 辅助电器设备检修、空调系统检修
- 多种学习方式的特许金融分析师试题及答案
- 早产儿脑出血预防
- 互帮互助的2024年特许金融分析师试题及答案
- 术中用药用血安全管理课件
- 2019年10月自考05760营养学一试题及答案含解析
- 中药凝胶贴膏剂的研究进展及在产品开发中的应用
- 福建省厦门市2022-2023学年六年级下学期数学期中试卷(含答案)
- 幼教培训课件:《常用的伴奏音型》
- 《重庆轻轨路线》课件
- 台州职业技术学院单招《职业技能测试》参考试题库(含答案)
- 2023年上海16区(浦东徐汇杨浦闵行等)数学高考二模汇编9 计数原理与概率统计含详解
- 2024年安徽警官职业学院高职单招(英语/数学/语文)笔试历年参考题库含答案解析
- 脑动脉供血不足查房课件
- 干洗行业安全培训
评论
0/150
提交评论