SlideShare a Scribd company logo
1 of 5
Download to read offline
BASIC VI COMMANDS
To Start vi
1. vi filename Create or Edit filename starting at line 1
2. vi -r filename Recover filename that was being edited
when system crashed
To Exit vi
1. :x<return> Quit vi, writing out modified file to file
named in original invocation
2. :wq<return> Quit vi, writing out modified file to file
named in original invocation
3. :q<return> Quit or exit vi
4. :q!<return> Quit vi even though latest changes have not
been saved for this vi call
Moving the cursor
1. j or <return>
[or down-arrow]
Move cursor down one line
2. k[or up-arrow] Move cursor up one line
3. h or<backspace>
[or left-arrow]
Move cursor left one line
l or<space>[or right-arrow] Move cursor right one line
4. 0(zero) Move cursor to start of current line(the one
with the arrow)
5. $ Move cursor to end of the current line
6. w Move cursor to beginning of next word
Basic vi commands
7. b Move cursor back to beginning of preceding
word
8. :0<return> or 1G Move cursor to first line in file
9. :n<return>or nG Move cursor to line n in file
10. :$<return>or G Move cursor to last line in file
Screen Manipulation
1. ^f Move forward one screen
2. ^b Move backward one screen
3. ^d Move down(forward) one half screen
4. ^u Move up(back)one half sreen
5. ^l Redraws the screen
6. ^r Redraws the screen,removing the deleted
lines
Adding,Changing,Deleting the text
1. u Undo whatever you just did(a simple toggle)
Inserting or Adding text
1. i Insert text before cursor,until<esc>hit
2. I Insert text at beginning of current
line,until<esc>hit
3. a Append text after cursor,until<esc>hit
4. A Append text to end of current
line,until<esc>hit
5. o Open and put text in a new line below
current line,until<esc>hit
6. O Open and put text in a new line above
current line,until<esc>hit
Basic vi commands
Changing the text
1. r Replace single character under cursor(no
<esc>needed)
2. R Replace characters,starting with current
cursor position,until<esc>hit
3. cw Change the current word with new
text,starting with the character under
cursor,until<esc>hit
4. cNw Change N words beginning with the
character under cursor,until<esc>hit
5. c change(replace)the characters in the
current line,until<esc>hit
6. cc change(replace)the characters in the
current line,stopping when <esc>hit
7. Ncc or cNc change(replace)the next N lines,starting
with the current line,stopping when
<esc>hit
Deleting the text
1. x Delete single character under cursor
2. Nx Delete N characters, starting with character
under cursor
3. dw Delete the single word beginning with
character under cursor
4. dNw Delete N words beginning with character
under cursor
5. D Delete the remainder of the line,starting
with current cursor position
6. dd Delete entire current line
7. Ndd or dNd Delete N lines beginning with the current
line
Basic vi commands
Cutting and pasting the text
1. yy Copy (yank,cut) the current line into buffer
2. Nyy or yNy copy(yank,cut) the next N lines,including
the current line, into the buffer
3. p put(paste) the lines in the buffer into the
text after the current line
Searching the text
1. /string Search forward for occurence of string in
text
2. ?string Search backward for occurence of string in
text
3. n Move to next occurence of search string
4. N Move to next occurence of search string in
opposite direction
Determining line numbers
1. :.= Returns line number of current line at
bottom of screen
2. := Returns the total number of lines at bottom
of the screen
3. ^g Provides the current line number, along
with the total number of lines,in the file at
the bottom of the screen
Saving and reading files
1. :r filename<return> Read file named filename and insert after
current line(the line with arrow)
Basic vi commands
2. :w<return> Write current contents to a file named in
original vi call
3. :w newfile<return> Write current contents to a new file named
newfile
4. :12,35w smallfile<return> Write the contents of the line numbered 12
through 35 to a new file named smallfile
5. :w! prevfile<return> Write current contents over a pre-existing
file named prevfile
Basic vi commands

More Related Content

Viewers also liked

Cryptography 130919084510-phpapp02
Cryptography 130919084510-phpapp02Cryptography 130919084510-phpapp02
Cryptography 130919084510-phpapp02Ravi Kashyap
 
Qualicat iso 9001_2015_v01_2febrer16
Qualicat iso 9001_2015_v01_2febrer16Qualicat iso 9001_2015_v01_2febrer16
Qualicat iso 9001_2015_v01_2febrer16Projecte de Qualitat
 
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-Projecte de Qualitat
 
Teknologi penyuluhan pertanian
Teknologi penyuluhan pertanianTeknologi penyuluhan pertanian
Teknologi penyuluhan pertaniandiani lupitasari
 
pengantar untuk menentukan income
pengantar untuk menentukan incomepengantar untuk menentukan income
pengantar untuk menentukan incomediani lupitasari
 
Some of shannon’s occupational identity in the form of photos
Some of shannon’s occupational identity in the form of photosSome of shannon’s occupational identity in the form of photos
Some of shannon’s occupational identity in the form of photosSmcle25
 
Top8_FranchiseRecruitingBrochure
Top8_FranchiseRecruitingBrochureTop8_FranchiseRecruitingBrochure
Top8_FranchiseRecruitingBrochureAyaz Aliyev
 
Actualitzacio avaluadors e2cat (2015)
Actualitzacio avaluadors e2cat (2015)Actualitzacio avaluadors e2cat (2015)
Actualitzacio avaluadors e2cat (2015)Projecte de Qualitat
 
pengantar untuk menentukan income
pengantar untuk menentukan incomepengantar untuk menentukan income
pengantar untuk menentukan incomediani lupitasari
 

Viewers also liked (16)

Cryptography 130919084510-phpapp02
Cryptography 130919084510-phpapp02Cryptography 130919084510-phpapp02
Cryptography 130919084510-phpapp02
 
Qualicat iso 9001_2015_v01_2febrer16
Qualicat iso 9001_2015_v01_2febrer16Qualicat iso 9001_2015_v01_2febrer16
Qualicat iso 9001_2015_v01_2febrer16
 
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-
PROCÉS ASSESSORAMENT I RECONEIXEMENT -SGQ-
 
Teknologi penyuluhan pertanian
Teknologi penyuluhan pertanianTeknologi penyuluhan pertanian
Teknologi penyuluhan pertanian
 
pengantar untuk menentukan income
pengantar untuk menentukan incomepengantar untuk menentukan income
pengantar untuk menentukan income
 
Presentations
PresentationsPresentations
Presentations
 
Some of shannon’s occupational identity in the form of photos
Some of shannon’s occupational identity in the form of photosSome of shannon’s occupational identity in the form of photos
Some of shannon’s occupational identity in the form of photos
 
Intro to junit
Intro to junitIntro to junit
Intro to junit
 
Llibre iso fdis_9001_cat_v07
Llibre iso fdis_9001_cat_v07Llibre iso fdis_9001_cat_v07
Llibre iso fdis_9001_cat_v07
 
Top8_FranchiseRecruitingBrochure
Top8_FranchiseRecruitingBrochureTop8_FranchiseRecruitingBrochure
Top8_FranchiseRecruitingBrochure
 
Exemple gestio x_processos
Exemple gestio x_processosExemple gestio x_processos
Exemple gestio x_processos
 
Actualitzacio avaluadors e2cat (2015)
Actualitzacio avaluadors e2cat (2015)Actualitzacio avaluadors e2cat (2015)
Actualitzacio avaluadors e2cat (2015)
 
pengantar untuk menentukan income
pengantar untuk menentukan incomepengantar untuk menentukan income
pengantar untuk menentukan income
 
Presentacio cloenda PQiMC 2016
Presentacio cloenda PQiMC 2016Presentacio cloenda PQiMC 2016
Presentacio cloenda PQiMC 2016
 
Ordo thysanoptera
Ordo thysanopteraOrdo thysanoptera
Ordo thysanoptera
 
Dinero Online
Dinero OnlineDinero Online
Dinero Online
 

Similar to Vicom

Vi editor Linux Editors
Vi editor Linux EditorsVi editor Linux Editors
Vi editor Linux EditorsTONO KURIAKOSE
 
Using VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarUsing VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarRohit Kumar
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdfssuser584832
 
VI Editors
VI EditorsVI Editors
VI EditorsDeivanai
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commandsFemi Adeyemi
 
Vi reference
Vi referenceVi reference
Vi referenceaireddy
 
1_Editors_in_Unix
1_Editors_in_Unix1_Editors_in_Unix
1_Editors_in_UnixGautam Raja
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editorJose Pla
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editorShay Cohen
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptxHarsha Patel
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptxHarsha Patel
 
Qc document draft
Qc document draftQc document draft
Qc document draftgourabehera
 

Similar to Vicom (20)

Vi editor Linux Editors
Vi editor Linux EditorsVi editor Linux Editors
Vi editor Linux Editors
 
Using vi editor
Using vi editorUsing vi editor
Using vi editor
 
Using VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit KumarUsing VI Editor in Red Hat by Rohit Kumar
Using VI Editor in Red Hat by Rohit Kumar
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
 
VI Editors
VI EditorsVI Editors
VI Editors
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi reference
Vi referenceVi reference
Vi reference
 
Vi reference
Vi referenceVi reference
Vi reference
 
Foss manual (1)
Foss manual (1)Foss manual (1)
Foss manual (1)
 
1_Editors_in_Unix
1_Editors_in_Unix1_Editors_in_Unix
1_Editors_in_Unix
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
 
07 vi text_editor
07 vi text_editor07 vi text_editor
07 vi text_editor
 
vim-cheatsheet.pdf
vim-cheatsheet.pdfvim-cheatsheet.pdf
vim-cheatsheet.pdf
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptx
 
Using Vi Editor.pptx
Using Vi Editor.pptxUsing Vi Editor.pptx
Using Vi Editor.pptx
 
vim
vimvim
vim
 
Qc document draft
Qc document draftQc document draft
Qc document draft
 

Vicom

  • 1. BASIC VI COMMANDS To Start vi 1. vi filename Create or Edit filename starting at line 1 2. vi -r filename Recover filename that was being edited when system crashed To Exit vi 1. :x<return> Quit vi, writing out modified file to file named in original invocation 2. :wq<return> Quit vi, writing out modified file to file named in original invocation 3. :q<return> Quit or exit vi 4. :q!<return> Quit vi even though latest changes have not been saved for this vi call Moving the cursor 1. j or <return> [or down-arrow] Move cursor down one line 2. k[or up-arrow] Move cursor up one line 3. h or<backspace> [or left-arrow] Move cursor left one line l or<space>[or right-arrow] Move cursor right one line 4. 0(zero) Move cursor to start of current line(the one with the arrow) 5. $ Move cursor to end of the current line 6. w Move cursor to beginning of next word Basic vi commands
  • 2. 7. b Move cursor back to beginning of preceding word 8. :0<return> or 1G Move cursor to first line in file 9. :n<return>or nG Move cursor to line n in file 10. :$<return>or G Move cursor to last line in file Screen Manipulation 1. ^f Move forward one screen 2. ^b Move backward one screen 3. ^d Move down(forward) one half screen 4. ^u Move up(back)one half sreen 5. ^l Redraws the screen 6. ^r Redraws the screen,removing the deleted lines Adding,Changing,Deleting the text 1. u Undo whatever you just did(a simple toggle) Inserting or Adding text 1. i Insert text before cursor,until<esc>hit 2. I Insert text at beginning of current line,until<esc>hit 3. a Append text after cursor,until<esc>hit 4. A Append text to end of current line,until<esc>hit 5. o Open and put text in a new line below current line,until<esc>hit 6. O Open and put text in a new line above current line,until<esc>hit Basic vi commands
  • 3. Changing the text 1. r Replace single character under cursor(no <esc>needed) 2. R Replace characters,starting with current cursor position,until<esc>hit 3. cw Change the current word with new text,starting with the character under cursor,until<esc>hit 4. cNw Change N words beginning with the character under cursor,until<esc>hit 5. c change(replace)the characters in the current line,until<esc>hit 6. cc change(replace)the characters in the current line,stopping when <esc>hit 7. Ncc or cNc change(replace)the next N lines,starting with the current line,stopping when <esc>hit Deleting the text 1. x Delete single character under cursor 2. Nx Delete N characters, starting with character under cursor 3. dw Delete the single word beginning with character under cursor 4. dNw Delete N words beginning with character under cursor 5. D Delete the remainder of the line,starting with current cursor position 6. dd Delete entire current line 7. Ndd or dNd Delete N lines beginning with the current line Basic vi commands
  • 4. Cutting and pasting the text 1. yy Copy (yank,cut) the current line into buffer 2. Nyy or yNy copy(yank,cut) the next N lines,including the current line, into the buffer 3. p put(paste) the lines in the buffer into the text after the current line Searching the text 1. /string Search forward for occurence of string in text 2. ?string Search backward for occurence of string in text 3. n Move to next occurence of search string 4. N Move to next occurence of search string in opposite direction Determining line numbers 1. :.= Returns line number of current line at bottom of screen 2. := Returns the total number of lines at bottom of the screen 3. ^g Provides the current line number, along with the total number of lines,in the file at the bottom of the screen Saving and reading files 1. :r filename<return> Read file named filename and insert after current line(the line with arrow) Basic vi commands
  • 5. 2. :w<return> Write current contents to a file named in original vi call 3. :w newfile<return> Write current contents to a new file named newfile 4. :12,35w smallfile<return> Write the contents of the line numbered 12 through 35 to a new file named smallfile 5. :w! prevfile<return> Write current contents over a pre-existing file named prevfile Basic vi commands