SlideShare a Scribd company logo
vi editor commands

3 modes of vi                                      deleting                                  searching
command mode                                       x          delete current character       /foo           search forward for “foo”
you can navigate the file and use the commands     10x        delete 10 characters           ?foo           search backwards for “foo”
shown on this page
                                                   dd         delete current line            n              repeat last search
insert mode
                                                   6dd        delete six lines
you can type into the file, and with vim you can
                                                   d0         delete to beginning of line    saving, exiting
still move around the file
                                                   d$         delete to end of line          :w            write contents to disk
last-line mode
you can issue complicated commands on the                                                    :wq           write contents and quit
last line of the editor                            navigation – up, down                     ZZ            write contents and quit
                                                   [Up]       move up one line               :q            quit
editing                                            5[Up]      move up 5 lines                :q!           quit and don’t save changes
i          insert                                  [Down]     move down 1 line
o          open a new line (below)                 6[Down]    move down 6 lines              miscellaneous
O          open a new line (above)                 1G         go to line 1
                                                                                             :!ls          run “ls” command from editor
a          append                                  15G        go to line 15                  :r foo        read file foo into this file
A          append at end of line                   G          go to last line                :10,20d       delete lines 10-20
u          undo                                    H          go to top of screen (high)
           repeat last command                     M          go to middle of screen
.                                                                                            more miscellaneous
                                                   L          go to bottom of screen (low)
                                                                                             :1,$s/foo/bar/g
cutting and pasting
                                                                                             from the first line to the last line change all
yy         yank (copy)                             navigation – left, right                  ocurrences of “foo” to “bar”
5yy        yank 5 lines                            w          go to next word
                                                                                             first[Ctrl][p]
dd         delete current line                     7w         move over 7 words
                                                                                             vi auto-complete; turns “first” into
6dd        delete six lines                        b          back one word
                                                                                             “firstName”, assuming you have a variable in
p          paste (below current line)              0          go to beginning of line        the file named firstName
           (lower-case ‘p’)                        $          go to end of line
P          paste (above current line)
           (capital ‘P’)                                                                                             devdaily.com/unix

More Related Content

PPTX
Html 5 Features And Benefits
KEY
HTML CSS & Javascript
PPT
JDBC – Java Database Connectivity
PPTX
Unix - Filters
PPTX
Android data binding
PPTX
Presentation about html5 css3
PPTX
04 activities and activity life cycle
PDF
Introduction to HTML5
Html 5 Features And Benefits
HTML CSS & Javascript
JDBC – Java Database Connectivity
Unix - Filters
Android data binding
Presentation about html5 css3
04 activities and activity life cycle
Introduction to HTML5

What's hot (20)

PPT
Java Basics
PPT
CSS
PPTX
Spring Security 5
PPTX
Bootstrap ppt
PDF
Selenium Webdriver Interview Questions
PPT
Introduction to Javascript
PDF
NestJS - O framework progressivo
PDF
Android-Tp4: stockage
PPT
Javascript
PPTX
Django Girls Tutorial
PDF
Introduction to web programming with JavaScript
PPT
Test Driven Development
PDF
Support de cours technologie et application m.youssfi
PPTX
Learn SoapUI
PDF
Spring Boot
PPT
Java Script ppt
PPT
SQLITE Android
PPT
Html presentation
PPTX
Html forms
PDF
JavaScript - Chapter 15 - Debugging Techniques
Java Basics
CSS
Spring Security 5
Bootstrap ppt
Selenium Webdriver Interview Questions
Introduction to Javascript
NestJS - O framework progressivo
Android-Tp4: stockage
Javascript
Django Girls Tutorial
Introduction to web programming with JavaScript
Test Driven Development
Support de cours technologie et application m.youssfi
Learn SoapUI
Spring Boot
Java Script ppt
SQLITE Android
Html presentation
Html forms
JavaScript - Chapter 15 - Debugging Techniques
Ad

Viewers also liked (9)

PDF
Curso ExtJS 4 - Aula 01 - Introdução
PDF
Preparando o Ambiente para Desenvolver em iOS (iPhone e iPad)
PDF
Preparando o Ambiente para Desenvolver em Android
PPTX
Sencha touch
PDF
Introdução ao Sencha por Flávia Siqueira
PDF
Curso Sencha Touch 2 - Aula01 - Introdução ao Sencha Touch 2
PDF
Mobile Summit Brazil: Ionic 2
PDF
Open Source Mobile Experience: Ionic 2
PDF
Novidades Angular 4.x e CLI
Curso ExtJS 4 - Aula 01 - Introdução
Preparando o Ambiente para Desenvolver em iOS (iPhone e iPad)
Preparando o Ambiente para Desenvolver em Android
Sencha touch
Introdução ao Sencha por Flávia Siqueira
Curso Sencha Touch 2 - Aula01 - Introdução ao Sencha Touch 2
Mobile Summit Brazil: Ionic 2
Open Source Mobile Experience: Ionic 2
Novidades Angular 4.x e CLI
Ad

Similar to Vi Editor Cheat Sheet (20)

PDF
Vi Cheat Sheet v 1 00
PDF
API TEST
PDF
API TEST
PDF
Vi Cheat Sheet
PDF
Vi cheat sheet
PDF
Vi help-sheet-011
PDF
Emacs Cheat Sheet
PDF
Vi CheatSheet
PDF
Using VI Editor in Red Hat by Rohit Kumar
PDF
Using vi editor
PDF
vi cheat sheet
PDF
Mission vim possible-full
KEY
Vim Cards - Keynote Format
PDF
Tuffarsi in vim
PDF
Vi reference
PDF
Vi reference
PDF
VIM for Programmers
PPSX
vim - Tips and_tricks
PDF
VIM for (PHP) Programmers
KEY
VIM for the PHP Developer
Vi Cheat Sheet v 1 00
API TEST
API TEST
Vi Cheat Sheet
Vi cheat sheet
Vi help-sheet-011
Emacs Cheat Sheet
Vi CheatSheet
Using VI Editor in Red Hat by Rohit Kumar
Using vi editor
vi cheat sheet
Mission vim possible-full
Vim Cards - Keynote Format
Tuffarsi in vim
Vi reference
Vi reference
VIM for Programmers
vim - Tips and_tricks
VIM for (PHP) Programmers
VIM for the PHP Developer

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Modernizing your data center with Dell and AMD
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Encapsulation theory and applications.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
KodekX | Application Modernization Development
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Machine learning based COVID-19 study performance prediction
PDF
Electronic commerce courselecture one. Pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Modernizing your data center with Dell and AMD
Understanding_Digital_Forensics_Presentation.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Encapsulation theory and applications.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Chapter 3 Spatial Domain Image Processing.pdf
NewMind AI Monthly Chronicles - July 2025
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
KodekX | Application Modernization Development
Dropbox Q2 2025 Financial Results & Investor Presentation
Machine learning based COVID-19 study performance prediction
Electronic commerce courselecture one. Pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Cloud computing and distributed systems.

Vi Editor Cheat Sheet

  • 1. vi editor commands 3 modes of vi deleting searching command mode x delete current character /foo search forward for “foo” you can navigate the file and use the commands 10x delete 10 characters ?foo search backwards for “foo” shown on this page dd delete current line n repeat last search insert mode 6dd delete six lines you can type into the file, and with vim you can d0 delete to beginning of line saving, exiting still move around the file d$ delete to end of line :w write contents to disk last-line mode you can issue complicated commands on the :wq write contents and quit last line of the editor navigation – up, down ZZ write contents and quit [Up] move up one line :q quit editing 5[Up] move up 5 lines :q! quit and don’t save changes i insert [Down] move down 1 line o open a new line (below) 6[Down] move down 6 lines miscellaneous O open a new line (above) 1G go to line 1 :!ls run “ls” command from editor a append 15G go to line 15 :r foo read file foo into this file A append at end of line G go to last line :10,20d delete lines 10-20 u undo H go to top of screen (high) repeat last command M go to middle of screen . more miscellaneous L go to bottom of screen (low) :1,$s/foo/bar/g cutting and pasting from the first line to the last line change all yy yank (copy) navigation – left, right ocurrences of “foo” to “bar” 5yy yank 5 lines w go to next word first[Ctrl][p] dd delete current line 7w move over 7 words vi auto-complete; turns “first” into 6dd delete six lines b back one word “firstName”, assuming you have a variable in p paste (below current line) 0 go to beginning of line the file named firstName (lower-case ‘p’) $ go to end of line P paste (above current line) (capital ‘P’) devdaily.com/unix