SlideShare a Scribd company logo
VI/VIM Text Editors
VI/VIM Overview
• VI is an interactive text-based editor which can be used to
create and/or change files, it is the standard in UNIX systems
for several decades.
• VI is hard to master but once mastered, it becomes a very
powerful and quick editing tool.
• The Linux version is called VIM (VI Improved) which makes
editing easier as it contains some in-editor navigation and
editing tools which make the user’s life easier.
• Some alternatives to VI/VIM are:
 EMACS
 Pico
 Nano
 gedit
The VI Command
• Once started, VI will fill the entire terminal screen until exited
and returned to the shell prompt.
• VI is old, it originated from a predecessor called “ed” which
was used on printer terminals hence its commands and
shortcuts are different than the keyboard shortcuts we know
in modern systems, such as CTRL-[letter].
• Starting VI:
 vi [filename(s)] – enters the editor while editing the file(s) specified.
 view [filename(s)] – opens the file(s) in read-only mode.
 vi –r [filename] – recovers a crashed file.
VI Modes
• VI has three work modes:
 Insert mode – used for adding / editing text; hit ESC in insert mode to
return to command mode.
 Command mode – this is the default mode that VI enters once it is
executed; the keys we hit will not be displayed on screen but this
mode does allow us to use VI’s commands, which are short sequences
of characters and key-combinations.
 Last-line mode – displays a cursor in the bottom line of VI, allowing us
to see the commands we type in; hit <CR> in order to return to
command mode.
• Note that in order to move from Insert mode to Last-line
mode, we must first pass through Command mode.
Insert Mode
• In order to append or insert new text we can use one of the
following options:
 a – Append text after cursor.
 A – Append text at the end of the current line.
 i – Insert text before the cursor.
 I – Insert text at the beginning of the line.
 o – Open a new line below the cursor.
 O – Open a new line above the cursor.
• There are many ways to achieve the same goal so there is no
need to remember all of the shortcuts.
Cursor Movement
• VIM supports moving the cursor around with the keyboard
arrows; VI only allows arrow navigation in newer versions.
• We can use the following alternatives to move around:
 0 – go to the beginning of the line.
 $ - go to the end of the line.
 [n]G – jump to line number [n].
 G – jump to last line in the file.
 gg – jump to the first line in the file.
 b – jump to the beginning of the word.
 e – jump to the end of the word.
 w – jump to the beginning of the next word.
 ^L – refresh the screen
• These are just some of the basic controls, there are many
more.
Command Mode
• Pressing ESC returns VI from insert to command mode.
• Basic command structure in VI:
 [count][command][scope]
• Let’s break down the command 10dw for example:
 10 – this is the count of objects we wish the command to affect.
 d – “d” refers to delete.
 w – “w” is the scope, in this case – words.
• The above command will delete 10 words, beginning at the
current location of the cursor.
Delete Commands
• x – delete 1 character right of the cursor.
• X – delete 1 character left of the cursor.
• dd – delete the entire current line
• dw – deletes to the beginning of the next word
• d3l – deletes the next 3 characters. (l is lower-case L)
• d0 – deletes to the beginning of the line.
• d$ - deletes to the end of the line.
• d1G – deletes to the beginning of the file.
• dG – deletes to the end of the file.
• D - deletes to the end of the line.
• Note that “d” commands delete to a buffer, as long as we
have not quit VI we can always use undo/redo.
Change Commands
• r – replace (overwrite) under the cursor.
• R – enter Replace mode (overwrites any existing text)
• cc – changes a complete line.
• cw – changes to the beginning of the next word.
• c3l – changes the next 3 characters.
• c0 – changes to the beginning of the line.
• c$ – changes to the end of the line.
• c1G – changes to the beginning of the file.
• cG – changes to the end of the file.
• C – changes to the end of the line.
Cut, Copy & Paste Commands
• y – yanks (copies) text to buffer
• yy - yanks a complete line
• yw – yanks to the beginning of the next word
• y0 – yanks to the beginning of the line
• y$ – yanks to the end of the line
• The “d” commands are used to cut text.
• p – paste everything in the buffer after the cursor location.
• P – paste everything in the buffer before the cursor.
Misc Commands
• u – undo last change
• J – join current and next line
• . – repeat last command
• ~ - invert letter case and move on character to the right.
• ZZ – Save changes and exit VI
Last-Line Mode
• Search in VI:
 /[pattern] – search forward for pattern matches
 ?[pattern] – search backwards for pattern matches
 n – repeat last search
 N – repeat last search in the opposite direction
• Search & Replace:
 :s/search-string/replace-with-string/g – this command will search for
“search-string” throughout the file and replace it with “replace-with-
string”.
 :10,20s/search-string/replace-with-string/g – same as above but the
search will be performed only between lines 10 and 20.
 :s/search-string/replace-with-string/gc – this command will search
for “search-string” throughout the file and replace it with “replace-
with-string” but ask for confirmation before each replacement.
File Commands
• :r [filename] – read the file and place its contents under the
cursor.
• :w – write (saves changes).
• :w! – override write-protection mode and save changes.
• :w [filename] – save into a file with the specific name.
• :wq – save changes and quit VI
• :x – save changes and quit VI
• :q – quit without saving
• :q! – force quit without saving
• :![command] – execute a shell command
• :r![command] – execute a shell command and place its output in the file
being edited.
VI Options
• VI has many options that control its looks and behaviour.
• For the full list of options, type: “:set all”
• To enable an option, such as line numbering for example, use:
 :set number
• To disable an options, use:
 :set nonumber
• The above rule is true for any one of VI’s options.

More Related Content

What's hot

Presentacion vim
Presentacion vimPresentacion vim
Presentacion vimIcalia Labs
 
VI Editors
VI EditorsVI Editors
VI EditorsDeivanai
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vimsambismo
 
Mission vim possible-full
Mission vim possible-fullMission vim possible-full
Mission vim possible-fullSam Gottfried
 
Vim Vi Improved
Vim Vi ImprovedVim Vi Improved
Vim Vi Improved
Tusharadri Sarkar
 
Introduction to Vim, the text editor
Introduction to Vim, the text editorIntroduction to Vim, the text editor
Introduction to Vim, the text editor
Vysakh Sreenivasan
 
Vi Cheat Sheet v 1 00
Vi Cheat Sheet v 1 00Vi Cheat Sheet v 1 00
Vi Cheat Sheet v 1 00
Nicole Cordes
 
Vi Cheat Sheet
Vi Cheat SheetVi Cheat Sheet
Vi Cheat Sheet
Loiane Groner
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat Sheet
Loiane Groner
 
Rhel2
Rhel2Rhel2
Vi CheatSheet
Vi CheatSheetVi CheatSheet
Vi CheatSheet
framinazzi
 
Aes(Advance Encryption Algorithm)
Aes(Advance Encryption Algorithm)Aes(Advance Encryption Algorithm)
Aes(Advance Encryption Algorithm)
MuskanSony
 
Vi reference
Vi referenceVi reference
Vi reference
aireddy
 
How To VIM
How To  VIMHow To  VIM
How To VIM
Diversido
 
Lukáš Šabľa - Vim
Lukáš Šabľa - VimLukáš Šabľa - Vim
Lukáš Šabľa - Vimwebelement
 

What's hot (17)

Presentacion vim
Presentacion vimPresentacion vim
Presentacion vim
 
VI Editors
VI EditorsVI Editors
VI Editors
 
Tuffarsi in vim
Tuffarsi in vimTuffarsi in vim
Tuffarsi in vim
 
Mission vim possible-full
Mission vim possible-fullMission vim possible-full
Mission vim possible-full
 
Vim Vi Improved
Vim Vi ImprovedVim Vi Improved
Vim Vi Improved
 
Introduction to Vim, the text editor
Introduction to Vim, the text editorIntroduction to Vim, the text editor
Introduction to Vim, the text editor
 
Vim basic
Vim basicVim basic
Vim basic
 
Vi Cheat Sheet v 1 00
Vi Cheat Sheet v 1 00Vi Cheat Sheet v 1 00
Vi Cheat Sheet v 1 00
 
Vi Cheat Sheet
Vi Cheat SheetVi Cheat Sheet
Vi Cheat Sheet
 
Vi Editor Cheat Sheet
Vi Editor Cheat SheetVi Editor Cheat Sheet
Vi Editor Cheat Sheet
 
Rhel2
Rhel2Rhel2
Rhel2
 
Vi CheatSheet
Vi CheatSheetVi CheatSheet
Vi CheatSheet
 
Vicom
VicomVicom
Vicom
 
Aes(Advance Encryption Algorithm)
Aes(Advance Encryption Algorithm)Aes(Advance Encryption Algorithm)
Aes(Advance Encryption Algorithm)
 
Vi reference
Vi referenceVi reference
Vi reference
 
How To VIM
How To  VIMHow To  VIM
How To VIM
 
Lukáš Šabľa - Vim
Lukáš Šabľa - VimLukáš Šabľa - Vim
Lukáš Šabľa - Vim
 

Viewers also liked

LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Referencewensheng wei
 
Installing Linux CentOs 5.0 Step-by-Step
Installing Linux CentOs 5.0 Step-by-StepInstalling Linux CentOs 5.0 Step-by-Step
Installing Linux CentOs 5.0 Step-by-Step
Mehdi Poustchi Amin
 
Hack wifi password using kali linux
Hack wifi password using kali linuxHack wifi password using kali linux
Hack wifi password using kali linux
Helder Oliveira
 
Tools kali
Tools kaliTools kali
Tools kali
ketban0702
 
introduction to system administration
introduction to system administrationintroduction to system administration
introduction to system administration
gamme123
 
Kali Linux Installation - VMware
Kali Linux Installation - VMwareKali Linux Installation - VMware
Kali Linux Installation - VMware
Ronan Dunne, CEH, SSCP
 
Amazing Origami Art - A Cool Japanese Paper Art
Amazing Origami Art  - A Cool Japanese Paper ArtAmazing Origami Art  - A Cool Japanese Paper Art
Amazing Origami Art - A Cool Japanese Paper Art
Targetseo.com
 
Mule ESB Training
Mule ESB TrainingMule ESB Training
Mule ESB Training
Attune University
 
Complete integration with mule esb
Complete integration with mule esbComplete integration with mule esb
Complete integration with mule esb
Son Nguyen
 
Future of Integration | MuleSoft
Future of Integration | MuleSoftFuture of Integration | MuleSoft
Future of Integration | MuleSoft
MuleSoft
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoft
MuleSoft
 
Sending mail in mule
Sending mail in muleSending mail in mule
Sending mail in mule
Son Nguyen
 
Integrate with ldap
Integrate with ldapIntegrate with ldap
Integrate with ldap
Son Nguyen
 
Mule ESB Fundamentals
Mule ESB FundamentalsMule ESB Fundamentals
Mule ESB Fundamentals
Naresh Chintalcheru
 
Rest security in mule
Rest security in muleRest security in mule
Rest security in mule
Son Nguyen
 
Schedule and monitor in mule
Schedule and monitor in muleSchedule and monitor in mule
Schedule and monitor in mule
Son Nguyen
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
Peter Martin
 
Installasi linux centos 6.8
Installasi linux centos 6.8Installasi linux centos 6.8
Installasi linux centos 6.8
Resha Yudiatama
 
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
Denny K
 
N map presentation
N map presentationN map presentation
N map presentation
ulirraptor
 

Viewers also liked (20)

LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Reference
 
Installing Linux CentOs 5.0 Step-by-Step
Installing Linux CentOs 5.0 Step-by-StepInstalling Linux CentOs 5.0 Step-by-Step
Installing Linux CentOs 5.0 Step-by-Step
 
Hack wifi password using kali linux
Hack wifi password using kali linuxHack wifi password using kali linux
Hack wifi password using kali linux
 
Tools kali
Tools kaliTools kali
Tools kali
 
introduction to system administration
introduction to system administrationintroduction to system administration
introduction to system administration
 
Kali Linux Installation - VMware
Kali Linux Installation - VMwareKali Linux Installation - VMware
Kali Linux Installation - VMware
 
Amazing Origami Art - A Cool Japanese Paper Art
Amazing Origami Art  - A Cool Japanese Paper ArtAmazing Origami Art  - A Cool Japanese Paper Art
Amazing Origami Art - A Cool Japanese Paper Art
 
Mule ESB Training
Mule ESB TrainingMule ESB Training
Mule ESB Training
 
Complete integration with mule esb
Complete integration with mule esbComplete integration with mule esb
Complete integration with mule esb
 
Future of Integration | MuleSoft
Future of Integration | MuleSoftFuture of Integration | MuleSoft
Future of Integration | MuleSoft
 
Application Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoftApplication Architecture: The Next Wave | MuleSoft
Application Architecture: The Next Wave | MuleSoft
 
Sending mail in mule
Sending mail in muleSending mail in mule
Sending mail in mule
 
Integrate with ldap
Integrate with ldapIntegrate with ldap
Integrate with ldap
 
Mule ESB Fundamentals
Mule ESB FundamentalsMule ESB Fundamentals
Mule ESB Fundamentals
 
Rest security in mule
Rest security in muleRest security in mule
Rest security in mule
 
Schedule and monitor in mule
Schedule and monitor in muleSchedule and monitor in mule
Schedule and monitor in mule
 
linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014linux-commandline-magic-Joomla-World-Conference-2014
linux-commandline-magic-Joomla-World-Conference-2014
 
Installasi linux centos 6.8
Installasi linux centos 6.8Installasi linux centos 6.8
Installasi linux centos 6.8
 
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
OSTU - Quickstart Guide for Wireshark (by Tony Fortunato)
 
N map presentation
N map presentationN map presentation
N map presentation
 

Similar to 07 vi text_editor

Vi Editor
Vi EditorVi Editor
swl--3 (1).docx
swl--3 (1).docxswl--3 (1).docx
swl--3 (1).docx
HimanshuKimothi
 
lectuer 21-22.pptx
lectuer 21-22.pptxlectuer 21-22.pptx
lectuer 21-22.pptx
poonam256394
 
Linux text editors Vim nano
Linux text editors Vim nano Linux text editors Vim nano
Linux text editors Vim nano
Md Meherab Hossen
 
1_Editors_in_Unix
1_Editors_in_Unix1_Editors_in_Unix
1_Editors_in_UnixGautam Raja
 
changing and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editorchanging and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editor
Shourya Puri
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
ssuser584832
 
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
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
AdelinaBronda1
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
shanmuga rajan
 
Python
PythonPython
Vi editor
Vi editorVi editor
Productive text editing with Vim
Productive text editing with VimProductive text editing with Vim
Productive text editing with Vim
bryanbibat
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
Femi Adeyemi
 
Vim Basics
Vim BasicsVim Basics
Vim Basics
parkerwightman
 
VI Editor - R.D.Sivakumar
VI Editor - R.D.SivakumarVI Editor - R.D.Sivakumar
VI Editor - R.D.Sivakumar
Sivakumar R D .
 

Similar to 07 vi text_editor (20)

Vi Editor
Vi EditorVi Editor
Vi Editor
 
swl--3 (1).docx
swl--3 (1).docxswl--3 (1).docx
swl--3 (1).docx
 
lectuer 21-22.pptx
lectuer 21-22.pptxlectuer 21-22.pptx
lectuer 21-22.pptx
 
Linux text editors Vim nano
Linux text editors Vim nano Linux text editors Vim nano
Linux text editors Vim nano
 
Using vi
Using viUsing vi
Using vi
 
1_Editors_in_Unix
1_Editors_in_Unix1_Editors_in_Unix
1_Editors_in_Unix
 
changing and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editorchanging and deleting text ,change word and line under vi editor
changing and deleting text ,change word and line under vi editor
 
015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf015-Editing-Files-With-Vi.pdf
015-Editing-Files-With-Vi.pdf
 
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
 
Using vi editor
Using vi editorUsing vi editor
Using vi editor
 
Vim Cheat Sheet.pdf
Vim Cheat Sheet.pdfVim Cheat Sheet.pdf
Vim Cheat Sheet.pdf
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
 
Python
PythonPython
Python
 
Vi editor
Vi editorVi editor
Vi editor
 
Productive text editing with Vim
Productive text editing with VimProductive text editing with Vim
Productive text editing with Vim
 
Vi editor commands
Vi editor commandsVi editor commands
Vi editor commands
 
Linex
LinexLinex
Linex
 
Vim Basics
Vim BasicsVim Basics
Vim Basics
 
VI Editor - R.D.Sivakumar
VI Editor - R.D.SivakumarVI Editor - R.D.Sivakumar
VI Editor - R.D.Sivakumar
 
Vim and Python
Vim and PythonVim and Python
Vim and Python
 

More from Shay Cohen

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
Shay Cohen
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
Shay Cohen
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
Shay Cohen
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
Shay Cohen
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
Shay Cohen
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
Shay Cohen
 
14 network tools
14 network tools14 network tools
14 network tools
Shay Cohen
 
13 process management
13 process management13 process management
13 process management
Shay Cohen
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
Shay Cohen
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
Shay Cohen
 
10 finding files
10 finding files10 finding files
10 finding files
Shay Cohen
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
Shay Cohen
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
Shay Cohen
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
Shay Cohen
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
Shay Cohen
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
Shay Cohen
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
Shay Cohen
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
Shay Cohen
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overviewShay Cohen
 

More from Shay Cohen (19)

Linux Performance Tunning Memory
Linux Performance Tunning MemoryLinux Performance Tunning Memory
Linux Performance Tunning Memory
 
Linux Performance Tunning Kernel
Linux Performance Tunning KernelLinux Performance Tunning Kernel
Linux Performance Tunning Kernel
 
Linux Performance Tunning introduction
Linux Performance Tunning introductionLinux Performance Tunning introduction
Linux Performance Tunning introduction
 
chroot and SELinux
chroot and SELinuxchroot and SELinux
chroot and SELinux
 
Linux Internals - Kernel/Core
Linux Internals - Kernel/CoreLinux Internals - Kernel/Core
Linux Internals - Kernel/Core
 
Infra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automationInfra / Cont delivery - 3rd party automation
Infra / Cont delivery - 3rd party automation
 
14 network tools
14 network tools14 network tools
14 network tools
 
13 process management
13 process management13 process management
13 process management
 
12 linux archiving tools
12 linux archiving tools12 linux archiving tools
12 linux archiving tools
 
11 linux filesystem copy
11 linux filesystem copy11 linux filesystem copy
11 linux filesystem copy
 
10 finding files
10 finding files10 finding files
10 finding files
 
08 text processing_tools
08 text processing_tools08 text processing_tools
08 text processing_tools
 
06 users groups_and_permissions
06 users groups_and_permissions06 users groups_and_permissions
06 users groups_and_permissions
 
05 standard io_and_pipes
05 standard io_and_pipes05 standard io_and_pipes
05 standard io_and_pipes
 
04 using and_configuring_bash
04 using and_configuring_bash04 using and_configuring_bash
04 using and_configuring_bash
 
03 browsing the filesystem
03 browsing the filesystem03 browsing the filesystem
03 browsing the filesystem
 
02 linux desktop usage
02 linux desktop usage02 linux desktop usage
02 linux desktop usage
 
09 string processing_with_regex copy
09 string processing_with_regex copy09 string processing_with_regex copy
09 string processing_with_regex copy
 
01 linux history overview
01 linux history overview01 linux history overview
01 linux history overview
 

Recently uploaded

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 

Recently uploaded (20)

From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 

07 vi text_editor

  • 2. VI/VIM Overview • VI is an interactive text-based editor which can be used to create and/or change files, it is the standard in UNIX systems for several decades. • VI is hard to master but once mastered, it becomes a very powerful and quick editing tool. • The Linux version is called VIM (VI Improved) which makes editing easier as it contains some in-editor navigation and editing tools which make the user’s life easier. • Some alternatives to VI/VIM are:  EMACS  Pico  Nano  gedit
  • 3. The VI Command • Once started, VI will fill the entire terminal screen until exited and returned to the shell prompt. • VI is old, it originated from a predecessor called “ed” which was used on printer terminals hence its commands and shortcuts are different than the keyboard shortcuts we know in modern systems, such as CTRL-[letter]. • Starting VI:  vi [filename(s)] – enters the editor while editing the file(s) specified.  view [filename(s)] – opens the file(s) in read-only mode.  vi –r [filename] – recovers a crashed file.
  • 4. VI Modes • VI has three work modes:  Insert mode – used for adding / editing text; hit ESC in insert mode to return to command mode.  Command mode – this is the default mode that VI enters once it is executed; the keys we hit will not be displayed on screen but this mode does allow us to use VI’s commands, which are short sequences of characters and key-combinations.  Last-line mode – displays a cursor in the bottom line of VI, allowing us to see the commands we type in; hit <CR> in order to return to command mode. • Note that in order to move from Insert mode to Last-line mode, we must first pass through Command mode.
  • 5. Insert Mode • In order to append or insert new text we can use one of the following options:  a – Append text after cursor.  A – Append text at the end of the current line.  i – Insert text before the cursor.  I – Insert text at the beginning of the line.  o – Open a new line below the cursor.  O – Open a new line above the cursor. • There are many ways to achieve the same goal so there is no need to remember all of the shortcuts.
  • 6. Cursor Movement • VIM supports moving the cursor around with the keyboard arrows; VI only allows arrow navigation in newer versions. • We can use the following alternatives to move around:  0 – go to the beginning of the line.  $ - go to the end of the line.  [n]G – jump to line number [n].  G – jump to last line in the file.  gg – jump to the first line in the file.  b – jump to the beginning of the word.  e – jump to the end of the word.  w – jump to the beginning of the next word.  ^L – refresh the screen • These are just some of the basic controls, there are many more.
  • 7. Command Mode • Pressing ESC returns VI from insert to command mode. • Basic command structure in VI:  [count][command][scope] • Let’s break down the command 10dw for example:  10 – this is the count of objects we wish the command to affect.  d – “d” refers to delete.  w – “w” is the scope, in this case – words. • The above command will delete 10 words, beginning at the current location of the cursor.
  • 8. Delete Commands • x – delete 1 character right of the cursor. • X – delete 1 character left of the cursor. • dd – delete the entire current line • dw – deletes to the beginning of the next word • d3l – deletes the next 3 characters. (l is lower-case L) • d0 – deletes to the beginning of the line. • d$ - deletes to the end of the line. • d1G – deletes to the beginning of the file. • dG – deletes to the end of the file. • D - deletes to the end of the line. • Note that “d” commands delete to a buffer, as long as we have not quit VI we can always use undo/redo.
  • 9. Change Commands • r – replace (overwrite) under the cursor. • R – enter Replace mode (overwrites any existing text) • cc – changes a complete line. • cw – changes to the beginning of the next word. • c3l – changes the next 3 characters. • c0 – changes to the beginning of the line. • c$ – changes to the end of the line. • c1G – changes to the beginning of the file. • cG – changes to the end of the file. • C – changes to the end of the line.
  • 10. Cut, Copy & Paste Commands • y – yanks (copies) text to buffer • yy - yanks a complete line • yw – yanks to the beginning of the next word • y0 – yanks to the beginning of the line • y$ – yanks to the end of the line • The “d” commands are used to cut text. • p – paste everything in the buffer after the cursor location. • P – paste everything in the buffer before the cursor.
  • 11. Misc Commands • u – undo last change • J – join current and next line • . – repeat last command • ~ - invert letter case and move on character to the right. • ZZ – Save changes and exit VI
  • 12. Last-Line Mode • Search in VI:  /[pattern] – search forward for pattern matches  ?[pattern] – search backwards for pattern matches  n – repeat last search  N – repeat last search in the opposite direction • Search & Replace:  :s/search-string/replace-with-string/g – this command will search for “search-string” throughout the file and replace it with “replace-with- string”.  :10,20s/search-string/replace-with-string/g – same as above but the search will be performed only between lines 10 and 20.  :s/search-string/replace-with-string/gc – this command will search for “search-string” throughout the file and replace it with “replace- with-string” but ask for confirmation before each replacement.
  • 13. File Commands • :r [filename] – read the file and place its contents under the cursor. • :w – write (saves changes). • :w! – override write-protection mode and save changes. • :w [filename] – save into a file with the specific name. • :wq – save changes and quit VI • :x – save changes and quit VI • :q – quit without saving • :q! – force quit without saving • :![command] – execute a shell command • :r![command] – execute a shell command and place its output in the file being edited.
  • 14. VI Options • VI has many options that control its looks and behaviour. • For the full list of options, type: “:set all” • To enable an option, such as line numbering for example, use:  :set number • To disable an options, use:  :set nonumber • The above rule is true for any one of VI’s options.

Editor's Notes

  1. VI and Emacs are the oldest - Emacs users vs VI users Learn at least one of them
  2. Switch ‘man vi’