SlideShare a Scribd company logo
6
Most read
8
Most read
9
Most read
VI EDITOR IN UNIX
SOME BASIC OPERATIONS AND INTRODUCTION
WHAT IS VI?
• The VI editor is a screen-based editor used by many Unix
users.
• vi is a screen-oriented text editor written by Bill Joy in 1976 for
an early BSD release.
• In other words, it’s a text editor that uses command line on a
Unix operating system.
WHAT IS VI?
• The vi editor is available on almost all Unix systems. vi can be used
from any type of terminal because it does not depend on arrow keys
and function keys--it uses the standard alphabetic keys for
commands.
• vi (pronounced "vee-eye") is short for "vi"sual editor. It displays a
window into the file being edited that shows 24 lines of text. vi is a
text editor, not a "what you see is what you get" word processor. vi
lets you add, change, and delete text, but does not provide such
formatting capabilities as centering lines or indenting paragraphs.
MODES:
vi has two different modes:
• Command Mode
In Command Mode, the characters you type are interpreted
as commands. For example: cut , copy , paste , search
operations ,moving the cursor etc.
• Insert Mode
In insert Mode, everything you type is inserted into the fie as
text
SWITCHING BETWEEN MODES:
• vi starts in Command Mode by default
• Type <Esc> to change from insert Mode to Command Mode.
• To get into the insert mode from command mode press ”i”.
• If you forget which mode you are in, hit the <Esc> key twice to
get to Command Mode.
• VI is case-sensitive. Be sure not to use a capital letter in place
of a lowercase letter.
CREATING/OPENING A FILE:
• Command: $ vi <filename>
• For Example : $ vi testfile
• By pressing enter a new file named ”testfile” opens in command
mode. If it already exists then it will open.
COPY:
• ‘yy’ will copy the entire line.
• Similarly ‘3yy’ will copy 3 lines and so on.
• ‘yw’ will copy word,7wy copies 7 words from current courser
location
CUT AND PASTE:
• Press ‘dd’ cut/delete the entire line.
• Similarly ‘3dd’ will cut/delete 3 lines.
• ‘dw’ is used to cut/delete a word.
• ‘x‘ delete character at cursor
• ‘X’ delete character to left of cursor
• ‘D’ delete from cursor to end of line
• Press ‘p’ for paste
SEARCHING:
• Command: /{letter}
• For example /ink searches ‘ink’ a in file.
• n repeats search in same direction
• N repeats search in opposite direction
REPLACE:
• ’r’ replace one character at a time.
• “R” keep replacing characters until <esc> was pressed.
UNDO AND REDO:
• u undo last change made in file.
• U restores the current line.
• Ctrl +r redo
SAVING AND EXITING:
:wq save the file and quits (same as ZZ)
:w save file but not quit VI
:q quits without saving
:q! force quit
ZZ quits VI and save edits
MOVING THE CURSOR:
h,  move cursor one position to the left
j , move cursor one position down
k , move cursor one position up
l , move cursor one position to the right
THANKS

More Related Content

PPTX
PPTX
Vi editor
PPT
Vi editor in linux
PPTX
PPT
Basic 50 linus command
PDF
Linux basic commands with examples
PPTX
Vi editor
PDF
Vi editor Linux Editors
Vi editor
Vi editor in linux
Basic 50 linus command
Linux basic commands with examples
Vi editor
Vi editor Linux Editors

What's hot (20)

PPTX
Linux Operating System
PPTX
Know the UNIX Commands
PPT
Linux architecture
PPTX
Vim Editor And Basic Scripting (Ch-7)
PDF
HCI U-II HCI software Process (1).pdf
DOCX
Software Engineering (Short & Long Questions)
PDF
Quick Guide with Linux Command Line
PPTX
Linux basic commands
PDF
sed(1)
PDF
Linux Presentation
PDF
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
PDF
Unix Programming Lab
PDF
Unix vs Linux | Difference Between Unix & Linux | Edureka
PPTX
Command prompt presentation
PPTX
Introduction to Linux
PPT
Basic command ppt
PDF
Linux Notes-1.pdf
PPTX
Basics of shell programming
PPTX
Linux introduction, class 1
Linux Operating System
Know the UNIX Commands
Linux architecture
Vim Editor And Basic Scripting (Ch-7)
HCI U-II HCI software Process (1).pdf
Software Engineering (Short & Long Questions)
Quick Guide with Linux Command Line
Linux basic commands
sed(1)
Linux Presentation
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Unix Programming Lab
Unix vs Linux | Difference Between Unix & Linux | Edureka
Command prompt presentation
Introduction to Linux
Basic command ppt
Linux Notes-1.pdf
Basics of shell programming
Linux introduction, class 1
Ad

Similar to VI editor in unix (20)

PPTX
lectuer 21-22.pptx
PPTX
Unit -6_linux operating system_1234.pptx
PPT
07 vi text_editor
DOCX
swl--3 (1).docx
PDF
Vim Basics
PPT
PDF
1_Editors_in_Unix
PPTX
Text editor In RHEL
PPTX
Vi and redirection & piping in linux
PDF
PPTX
Presentacion vim
PDF
Linux programming - Getting self started
PPT
Basic linux day 4
PPT
Introduction to vi editor
PPTX
Vim survival guide
PDF
Tuffarsi in vim
PDF
Linux text editors Vim nano
PDF
Linux text editors
PPTX
Vim - for newbies, by Roy Osherove
PDF
What is Vim?
lectuer 21-22.pptx
Unit -6_linux operating system_1234.pptx
07 vi text_editor
swl--3 (1).docx
Vim Basics
1_Editors_in_Unix
Text editor In RHEL
Vi and redirection & piping in linux
Presentacion vim
Linux programming - Getting self started
Basic linux day 4
Introduction to vi editor
Vim survival guide
Tuffarsi in vim
Linux text editors Vim nano
Linux text editors
Vim - for newbies, by Roy Osherove
What is Vim?
Ad

Recently uploaded (20)

PPTX
Institutional Correction lecture only . . .
PDF
TR - Agricultural Crops Production NC III.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Computing-Curriculum for Schools in Ghana
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Complications of Minimal Access Surgery at WLH
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Cell Types and Its function , kingdom of life
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Institutional Correction lecture only . . .
TR - Agricultural Crops Production NC III.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
RMMM.pdf make it easy to upload and study
VCE English Exam - Section C Student Revision Booklet
O7-L3 Supply Chain Operations - ICLT Program
human mycosis Human fungal infections are called human mycosis..pptx
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Computing-Curriculum for Schools in Ghana
Abdominal Access Techniques with Prof. Dr. R K Mishra
Complications of Minimal Access Surgery at WLH
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Insiders guide to clinical Medicine.pdf
Cell Types and Its function , kingdom of life
Final Presentation General Medicine 03-08-2024.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...

VI editor in unix

  • 1. VI EDITOR IN UNIX SOME BASIC OPERATIONS AND INTRODUCTION
  • 2. WHAT IS VI? • The VI editor is a screen-based editor used by many Unix users. • vi is a screen-oriented text editor written by Bill Joy in 1976 for an early BSD release. • In other words, it’s a text editor that uses command line on a Unix operating system.
  • 3. WHAT IS VI? • The vi editor is available on almost all Unix systems. vi can be used from any type of terminal because it does not depend on arrow keys and function keys--it uses the standard alphabetic keys for commands. • vi (pronounced "vee-eye") is short for "vi"sual editor. It displays a window into the file being edited that shows 24 lines of text. vi is a text editor, not a "what you see is what you get" word processor. vi lets you add, change, and delete text, but does not provide such formatting capabilities as centering lines or indenting paragraphs.
  • 4. MODES: vi has two different modes: • Command Mode In Command Mode, the characters you type are interpreted as commands. For example: cut , copy , paste , search operations ,moving the cursor etc. • Insert Mode In insert Mode, everything you type is inserted into the fie as text
  • 5. SWITCHING BETWEEN MODES: • vi starts in Command Mode by default • Type <Esc> to change from insert Mode to Command Mode. • To get into the insert mode from command mode press ”i”. • If you forget which mode you are in, hit the <Esc> key twice to get to Command Mode. • VI is case-sensitive. Be sure not to use a capital letter in place of a lowercase letter.
  • 6. CREATING/OPENING A FILE: • Command: $ vi <filename> • For Example : $ vi testfile • By pressing enter a new file named ”testfile” opens in command mode. If it already exists then it will open.
  • 7. COPY: • ‘yy’ will copy the entire line. • Similarly ‘3yy’ will copy 3 lines and so on. • ‘yw’ will copy word,7wy copies 7 words from current courser location
  • 8. CUT AND PASTE: • Press ‘dd’ cut/delete the entire line. • Similarly ‘3dd’ will cut/delete 3 lines. • ‘dw’ is used to cut/delete a word. • ‘x‘ delete character at cursor • ‘X’ delete character to left of cursor • ‘D’ delete from cursor to end of line • Press ‘p’ for paste
  • 9. SEARCHING: • Command: /{letter} • For example /ink searches ‘ink’ a in file. • n repeats search in same direction • N repeats search in opposite direction
  • 10. REPLACE: • ’r’ replace one character at a time. • “R” keep replacing characters until <esc> was pressed.
  • 11. UNDO AND REDO: • u undo last change made in file. • U restores the current line. • Ctrl +r redo
  • 12. SAVING AND EXITING: :wq save the file and quits (same as ZZ) :w save file but not quit VI :q quits without saving :q! force quit ZZ quits VI and save edits
  • 13. MOVING THE CURSOR: h,  move cursor one position to the left j , move cursor one position down k , move cursor one position up l , move cursor one position to the right