SlideShare a Scribd company logo
1 of 5
Download to read offline
vi Editor Commands
Quick links...
General Startup
Counts
Cursor Movement
Screen Movement
Inserting
Deleting
Copying Code
Put Command
Find Commands
Miscellaneous Commands
Line Editor Mode
ex Commands
Substitutions
Reading Files
Write File
Moving
Shell Escape
General Startup
To use vi: vi filename
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!
To enter vi command mode: [esc]
Counts
A number preceding any vi command tells vi to repeat
that command that many times.
Cursor Movement
h move left (backspace)
j move down
k move up
l move right (spacebar)
vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html
1 of 5 08-Apr-15 13:50
[return] move to the beginning of the next line
$ last column on the current line
0 move cursor to the first column on the
current line
^ move cursor to first nonblank column on the
current line
w move to the beginning of the next word or
punctuation mark
W move past the next space
b move to the beginning of the previous word
or punctuation mark
B move to the beginning of the previous word,
ignores punctuation
e end of next word or punctuation mark
E end of next word, ignoring punctuation
H move cursor to the top of the screen
M move cursor to the middle of the screen
L move cursor to the bottom of the screen
Screen Movement
G move to the last line in the file
xG move to line x
z+ move current line to top of screen
z move current line to the middle of screen
z- move current line to the bottom of screen
^F move forward one screen
^B move backward one line
^D move forward one half screen
^U move backward one half screen
^R redraw screen
( does not work with VT100 type terminals )
^L redraw screen
( does not work with Televideo terminals )
vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html
2 of 5 08-Apr-15 13:50
Inserting
r replace character under cursor with next
character typed
R keep replacing character until [esc] is hit
i insert before cursor
a append after cursor
A append at end of line
O open line above cursor and enter append mode
Deleting
x delete character under cursor
dd delete line under cursor
dw delete word under cursor
db delete word before cursor
Copying Code
yy (yank)'copies' line which may then be put by
the p(put) command. Precede with a count for
multiple lines.
Put Command
brings back previous deletion or yank of lines,
words, or characters
P bring back before cursor
p bring back after cursor
Find Commands
? finds a word going backwards
/ finds a word going forwards
f finds a character on the line under the
cursor going forward
F finds a character on the line under the
cursor going backwards
vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html
3 of 5 08-Apr-15 13:50
t find a character on the current line going
forward and stop one character before it
T find a character on the current line going
backward and stop one character before it
; repeat last f, F, t, T
Miscellaneous Commands
. repeat last command
u undoes last command issued
U undoes all commands on one line
xp deletes first character and inserts after
second (swap)
J join current line with the next line
^G display current line number
% if at one parenthesis, will jump to its mate
mx mark current line with character x
'x find line marked with character x
NOTE: Marks are internal and not written to the file.
Line Editor Mode
Any commands form the line editor ex can be issued
upon entering line mode.
To enter: type ':'
To exit: press[return] or [esc]
ex Commands
For a complete list consult the
UNIX Programmer's Manual
READING FILES
copies (reads) filename after cursor in file
currently editing
:r filename
vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html
4 of 5 08-Apr-15 13:50
WRITE FILE
:w saves the current file without quitting
MOVING
:# move to line #
:$ move to last line of file
SHELL ESCAPE
executes 'cmd' as a shell command.
:!'cmd'
vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html
5 of 5 08-Apr-15 13:50

More Related Content

What's hot (19)

Vi Cheat Sheet
Vi Cheat SheetVi Cheat Sheet
Vi Cheat Sheet
 
Vi CheatSheet
Vi CheatSheetVi CheatSheet
Vi CheatSheet
 
Ruby mine referencecard
Ruby mine referencecardRuby mine referencecard
Ruby mine referencecard
 
Faisal
FaisalFaisal
Faisal
 
Newton cotes method
Newton cotes methodNewton cotes method
Newton cotes method
 
TKPJava Eclipse and Codenvy IDE Keyboard Shortcuts
TKPJava Eclipse and Codenvy IDE Keyboard ShortcutsTKPJava Eclipse and Codenvy IDE Keyboard Shortcuts
TKPJava Eclipse and Codenvy IDE Keyboard Shortcuts
 
05 Jo P May 07
05 Jo P May 0705 Jo P May 07
05 Jo P May 07
 
Php storm reference_card
Php storm reference_cardPhp storm reference_card
Php storm reference_card
 
week-7x
week-7xweek-7x
week-7x
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1Bcsl 033 data and file structures lab s1-1
Bcsl 033 data and file structures lab s1-1
 
Temp conversion
Temp conversionTemp conversion
Temp conversion
 
Ember js meetup treviso liquid-fire
Ember js meetup treviso liquid-fireEmber js meetup treviso liquid-fire
Ember js meetup treviso liquid-fire
 
Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4
 
SLIME
SLIMESLIME
SLIME
 
Basic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.comBasic of c programming www.eakanchha.com
Basic of c programming www.eakanchha.com
 
week-6x
week-6xweek-6x
week-6x
 
Tmux cheatsheet
Tmux cheatsheetTmux cheatsheet
Tmux cheatsheet
 

Viewers also liked

Viewers also liked (20)

Les 11 fl2
Les 11 fl2Les 11 fl2
Les 11 fl2
 
Les 06 rec
Les 06 recLes 06 rec
Les 06 rec
 
Remote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By Presentation
Remote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By PresentationRemote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By Presentation
Remote DBA team-1Z0-042 Oracle Sga In Nutshell Oracle Dba Learn By Presentation
 
Xpp c user_rec
Xpp c user_recXpp c user_rec
Xpp c user_rec
 
Les 02 config
Les 02 configLes 02 config
Les 02 config
 
Les 07 rman_rec
Les 07 rman_recLes 07 rman_rec
Les 07 rman_rec
 
Oracle data guard broker 12c
Oracle data guard broker 12cOracle data guard broker 12c
Oracle data guard broker 12c
 
Les 05 create_bu
Les 05 create_buLes 05 create_bu
Les 05 create_bu
 
Les 18 space
Les 18 spaceLes 18 space
Les 18 space
 
Les 19 space_db
Les 19 space_dbLes 19 space_db
Les 19 space_db
 
Les 09 diag
Les 09 diagLes 09 diag
Les 09 diag
 
Les 16 resource
Les 16 resourceLes 16 resource
Les 16 resource
 
Les 04 config_bu
Les 04 config_buLes 04 config_bu
Les 04 config_bu
 
Xpp b tspitr
Xpp b tspitrXpp b tspitr
Xpp b tspitr
 
Server control utility reference
Server control utility referenceServer control utility reference
Server control utility reference
 
Les 17 sched
Les 17 schedLes 17 sched
Les 17 sched
 
Les 20 dup_db
Les 20 dup_dbLes 20 dup_db
Les 20 dup_db
 
Les 12 fl_db
Les 12 fl_dbLes 12 fl_db
Les 12 fl_db
 
Les 13 memory
Les 13 memoryLes 13 memory
Les 13 memory
 
Les 10 fl1
Les 10 fl1Les 10 fl1
Les 10 fl1
 

Similar to Vi editor commands

Similar to Vi editor commands (20)

Vi editor
Vi editorVi editor
Vi editor
 
vim-cheatsheet.pdf
vim-cheatsheet.pdfvim-cheatsheet.pdf
vim-cheatsheet.pdf
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
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
 
VI Editors
VI EditorsVI Editors
VI Editors
 
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
 
Beginning with vi text editor
Beginning with vi text editorBeginning with vi text editor
Beginning with vi text editor
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
101 3.8.2 vim reference card
101 3.8.2 vim reference card101 3.8.2 vim reference card
101 3.8.2 vim reference card
 
3.8.b vim reference card
3.8.b vim reference card3.8.b vim reference card
3.8.b vim reference card
 
Introduction to vi editor
Introduction to vi editorIntroduction to vi editor
Introduction to vi editor
 
1_Editors_in_Unix
1_Editors_in_Unix1_Editors_in_Unix
1_Editors_in_Unix
 
Vi reference
Vi referenceVi reference
Vi reference
 
Vi reference
Vi referenceVi reference
Vi reference
 
API TEST
API TESTAPI TEST
API TEST
 
Vi cheat sheet
Vi cheat sheetVi cheat sheet
Vi cheat sheet
 
API TEST
API TESTAPI TEST
API TEST
 

More from Femi Adeyemi

Oracle database 12c sql tuning
Oracle database 12c sql tuningOracle database 12c sql tuning
Oracle database 12c sql tuningFemi Adeyemi
 
High availability overview: Oracle Database 12c
High availability overview: Oracle Database 12cHigh availability overview: Oracle Database 12c
High availability overview: Oracle Database 12cFemi Adeyemi
 

More from Femi Adeyemi (9)

Les 15 perf_sql
Les 15 perf_sqlLes 15 perf_sql
Les 15 perf_sql
 
Les 14 perf_db
Les 14 perf_dbLes 14 perf_db
Les 14 perf_db
 
Les 08 tune_rman
Les 08 tune_rmanLes 08 tune_rman
Les 08 tune_rman
 
Les 03 catalog
Les 03 catalogLes 03 catalog
Les 03 catalog
 
Les 01 core
Les 01 coreLes 01 core
Les 01 core
 
Les 00 intro
Les 00 introLes 00 intro
Les 00 intro
 
Oracle database 12c sql tuning
Oracle database 12c sql tuningOracle database 12c sql tuning
Oracle database 12c sql tuning
 
High availability overview: Oracle Database 12c
High availability overview: Oracle Database 12cHigh availability overview: Oracle Database 12c
High availability overview: Oracle Database 12c
 
Hardening solaris
Hardening solarisHardening solaris
Hardening solaris
 

Recently uploaded

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 

Recently uploaded (20)

My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 

Vi editor commands

  • 1. vi Editor Commands Quick links... General Startup Counts Cursor Movement Screen Movement Inserting Deleting Copying Code Put Command Find Commands Miscellaneous Commands Line Editor Mode ex Commands Substitutions Reading Files Write File Moving Shell Escape General Startup To use vi: vi filename To exit vi and save changes: ZZ or :wq To exit vi without saving changes: :q! To enter vi command mode: [esc] Counts A number preceding any vi command tells vi to repeat that command that many times. Cursor Movement h move left (backspace) j move down k move up l move right (spacebar) vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html 1 of 5 08-Apr-15 13:50
  • 2. [return] move to the beginning of the next line $ last column on the current line 0 move cursor to the first column on the current line ^ move cursor to first nonblank column on the current line w move to the beginning of the next word or punctuation mark W move past the next space b move to the beginning of the previous word or punctuation mark B move to the beginning of the previous word, ignores punctuation e end of next word or punctuation mark E end of next word, ignoring punctuation H move cursor to the top of the screen M move cursor to the middle of the screen L move cursor to the bottom of the screen Screen Movement G move to the last line in the file xG move to line x z+ move current line to top of screen z move current line to the middle of screen z- move current line to the bottom of screen ^F move forward one screen ^B move backward one line ^D move forward one half screen ^U move backward one half screen ^R redraw screen ( does not work with VT100 type terminals ) ^L redraw screen ( does not work with Televideo terminals ) vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html 2 of 5 08-Apr-15 13:50
  • 3. Inserting r replace character under cursor with next character typed R keep replacing character until [esc] is hit i insert before cursor a append after cursor A append at end of line O open line above cursor and enter append mode Deleting x delete character under cursor dd delete line under cursor dw delete word under cursor db delete word before cursor Copying Code yy (yank)'copies' line which may then be put by the p(put) command. Precede with a count for multiple lines. Put Command brings back previous deletion or yank of lines, words, or characters P bring back before cursor p bring back after cursor Find Commands ? finds a word going backwards / finds a word going forwards f finds a character on the line under the cursor going forward F finds a character on the line under the cursor going backwards vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html 3 of 5 08-Apr-15 13:50
  • 4. t find a character on the current line going forward and stop one character before it T find a character on the current line going backward and stop one character before it ; repeat last f, F, t, T Miscellaneous Commands . repeat last command u undoes last command issued U undoes all commands on one line xp deletes first character and inserts after second (swap) J join current line with the next line ^G display current line number % if at one parenthesis, will jump to its mate mx mark current line with character x 'x find line marked with character x NOTE: Marks are internal and not written to the file. Line Editor Mode Any commands form the line editor ex can be issued upon entering line mode. To enter: type ':' To exit: press[return] or [esc] ex Commands For a complete list consult the UNIX Programmer's Manual READING FILES copies (reads) filename after cursor in file currently editing :r filename vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html 4 of 5 08-Apr-15 13:50
  • 5. WRITE FILE :w saves the current file without quitting MOVING :# move to line # :$ move to last line of file SHELL ESCAPE executes 'cmd' as a shell command. :!'cmd' vi Editor Commands http://www.cs.rit.edu/~cslab/vi.html 5 of 5 08-Apr-15 13:50