SlideShare a Scribd company logo
Filename Completion in the C Shell csh  will complete file names for if the  filec  shell variable is set set filec This will normally be in your .cshrc file Just type first part of name and press ESC Example: clyde% ls jerry john joe jimmy   wesley tom bill willie ken ted   shirley joan clyde%more jeESC clyde%more jerry shell types rest of name
Filename Completion If the prefix is ambiguous, the shell can’t read your mind so it completes as much as it can and beeps You can then indicate what file you want, hit ESC again and the filename will be completed Or, you can type CTRL-D and the shell will list all possible matches
Filename Completion Examples clyde% ls jerry john joe jimmy   wesley tom bill willie ken ted   shirley joan clyde% cat joESC cat jo hESC cat john clyde% cat joESC cat jo CTRL-D john  joe  joan cat jo
Preparing for Exams  (Subtitle: Learning Unix) Read the assigned readings in “Unix Primer Plus” Read about the commands and utilities in “UNIX in a Nutshell” Note that there are sections about the  Unix shell , the  Bourne shell , the  C shell ,  vi, ex, sed , and  awk  as well as the shorter command descriptions in section 2 Read the handouts in the lab notes,  Unix Editors, Redirection in Unix, Pattern Matching, and A printf Primer Experiment with the commands we discuss, use the man pages and the command descriptions in Section 2 of “Unix in a Nutshell” and try out the options and commands
What Will Exams Be Like? First exam will be Monday, September 27th Exams will be comprehensive! Exams are closed book, closed notes, computer monitor OFF, closed mouth (although I will entertain questions), and closed neighbor’s paper When you are done, you may have a maximum of 10 minutes open book, notes, and computer ON (man pages, try things, whatever) I will then let you break while I (hopefully) get the papers graded We will then go over the exams before we wrap up for the evening
ex - Yet Another Line Editor ex , just like  ed , is a line editor ex is the line editor which  vi , the visual editor, is based on This means that  all  of the  ex  commands are available from  vi Using the  ex  commands within  vi  can often simplify tasks
ex versus ed ed and ex have many similarities They both use line addresses They both use the same basic command set p, m, t, /expr/, ?expr?, r, w, q, d, u, ! command They also have some differences co as well as t for copy abbreviations sh to invoke a Unix shell set and setno : is the default command mode prompt
Visual Editor - vi vi is a screen editor, the unit of change is  character  rather than a line vi is found on most Unix installations Unlike MS-Word, WordPerfect, or other word processors,  vi  files consist of plain ASCII text  There are no special formatting codes  Unfortunately,  vi  is so feature rich that it is complex to learn and takes considerable study and practice to master
Starting vi Command line options vi invokes  vi  with a blank buffer vi file invokes  vi  on  file  or on a blank buffer  using  file  for the name if  file  does not  exist vi file1 file2... invokes  vi  on  files  sequentially vi -R file invokes  vi  on  file  in read-only mode view file invokes  vi  on  file  in read-only mode vi -r file recovers  file  and recent edits after a  system crash (or at least tries!) vi + file opens  file  with cursor at last line vi +n file opens  file  with cursor at line n vi +/expr file opens  file  with cursor at  expr
vi Architecture vi  is based on ex All  ex  commands are available from within  vi Changing from  vi  to  ex  and back From  vi  command mode, a  Q  will switch to  ex From  ex  command mode  :vi  will switch back to  vi Like  ed  and  ex ,  vi  is modal Command and text entry modes
vi Buffers vi  is also based on memory buffers, like  ed , changes are made to the buffer, not your file until a write is performed vi  has three kinds of buffers the normal default buffer your edit file resides in the anonymous buffer, a special buffer used for copying text  named 1-9 hold the last nine deletions a-z for storing copied text (like the Windows clipboard)
Cursor Movement By Character  h, j, k, l (  ,    ,  ,  ) By Text Objects w or W  Forward a word b or B  Backwards a word e or E  End of word ) and (    Beginning of next, previous paragraph
Movement by Lines 0, $  Beginning, end of current line ^ First character of current line (ignore  spaces) +, - Next, previous line n Column  n  of current line H Top line of screen M Middle line of screen L Bottom line of screen n H n  (number) of lines after top line n L n  (number) of lines before bottom
Command Multipliers Almost any command can be executed multiple times by using a command multiplier Examples: 4j moves down 4 lines 6w or 6W moves forward 6 words 10dd deletes 10 lines, starting with the current line 5x deletes 5 characters y4w copies 4 words to the anonymous buffer
Screen Movement CTRL-F , CTRL-B Scroll forward/backwards  one screen CTRL-D , CTRL-U Scroll down/up one-half  screen CTRL-E , CTRL-Y Show one more line at  bottom/top of window z  RETURN Reposition current line to top  of screen z. Reposition current line to  middle of screen z- Reposition current line to  bottom of screen
Searches The search syntax in  vi  is similar to  ed  but only uses one search indicator /expr searches forward for expr ?expr searches backwards for expr n, N repeat last search in same, opposite  direction /, ? repeat previous search forward,  backward fx search forward for x on current line Fx search backwards for x on current line ; repeat previous current-line search , repeat previous current line search in  opposite direction
Using Line Numbers CTRL-G displays current line number n G Move to line number  n G Move to last line in file : n Move to line number  n
Marking Lines As in ed, lines can be marked so you can refer to them in commands other than by line number m x Mark current  cursor position  as  x :ma  x Mark current  line  as  x ` x Move cursor to  x `` Return to previous mark ‘ x Move to beginning of line containing  x ‘’ Return to beginning of line containing  previous mark
Inserting Text vi is more accommodating about inserting text in an empty file than ed All the insert commands work whether text exists or not i, a Insert text before/after cursor I, A Insert text at beginning/end of line o, O Open a new line for text below/above  cursor
Changing Text r replace character under cursor with next typed  character ~ Change case of character under cursor  cm Change text block defined by movement  command  m  (cw or cL for word or line) cc Change current line C Change to end of line R Type over characters s Delete character and substitute typed text S Delete current line and substitute typed text Note: r and ~ leave you in command mode
Deletions and Moves x Delete character under cursor X Delete character before cursor d m Delete text block defined by movement  command  m  (dw or dL for delete word or line) dd Delete current line D Delete from cursor to end of line p Put deleted text  before  cursor P Put deleted text  after  cursor
Yank and Put (Copy & Paste) Copying (Yanking) Text yy,Y Copy current line y m Copy text block defined by movement  command  m  (yw or yL for word or line) Note: multipliers can be used, ie; y3w for  yank 3 words or y10L for yank 10 lines Pasting (Put’ing) Text p, P Put yanked text after, before cursor
Other Commands u, U Undo last edit, restore current line J Join current and next lines Note case of command (J vs j) . (period) Repeat last edit CTRL-L  , Redraw Screen  CTRL-R
Reading :r  newfile Read  newfile  into current edit file :r ! command Read the output of Unix  command   into current edit file :e! Return to version of current file at  time of last write (discarding all  changes since last write) :e  file2 Edit  file2  without leaving vi :e # Edit alternate file
Writing :w Write (save) file :w! Write file (overriding file protection) :3,9w  newfile Write lines 3 through 9 to  newfile :3,9w>>file Write lines 3 through 9 appending to file :w%.new
Exiting ZZ Write (save) and quit :x Write (save) and quit :wq Write (save) and quit :q Quit :q! Quit discarding any unsaved changes Q Quit  vi  and invoke  ex :n Edit next file (if vi was started with the  vi file1 file2 ... variant)

More Related Content

PPTX
PPT
Vi editor in linux
PPT
Introduction to vi editor
PPT
1359 Vi Editor
PPTX
Vi editor
PDF
Vi editor Linux Editors
PPTX
Vi editor
PPTX
VI editor in unix
Vi editor in linux
Introduction to vi editor
1359 Vi Editor
Vi editor
Vi editor Linux Editors
Vi editor
VI editor in unix

What's hot (20)

PPTX
Vi editor
PPTX
Presentacion vim
PDF
Linux fundamental - Chap 07 vi
PPT
07 vi text_editor
PDF
1_Editors_in_Unix
PDF
Tuffarsi in vim
PDF
Productive text editing with Vim
DOC
Foss manual (1)
PDF
Unit 5 vim an advanced text editor
PDF
Introduction to Vim, the text editor
PDF
Unit 6 bash shell
PDF
PPTX
How To VIM
PDF
Tech talk 01.06.2017
PPS
An approach to Programming Contests with C++
DOCX
Killian Vigna Morse code
PDF
Instalación de emu8086 y compilados
PDF
Unit 11 configuring the bash shell – shell script
PDF
Emulador de ensamblador emu8086
Vi editor
Presentacion vim
Linux fundamental - Chap 07 vi
07 vi text_editor
1_Editors_in_Unix
Tuffarsi in vim
Productive text editing with Vim
Foss manual (1)
Unit 5 vim an advanced text editor
Introduction to Vim, the text editor
Unit 6 bash shell
How To VIM
Tech talk 01.06.2017
An approach to Programming Contests with C++
Killian Vigna Morse code
Instalación de emu8086 y compilados
Unit 11 configuring the bash shell – shell script
Emulador de ensamblador emu8086
Ad

Viewers also liked (18)

ODP
nen
PPT
Videos digitales
PPT
Eldonian- rachel smith
PPT
Borrachos 2
PPS
Camara Oculta
PPTX
Ulive2016
PPT
Carnestoltes
PPS
God S Pharmacy La Farmacia De Dios
PPT
LA ECONOMÍA
PPS
Fabrica De Zapatos De Moda En India
PPT
Economic Activity
PPTX
Why study population?
PPT
Eldonian Village
PPTX
Functional zones Dublin
PPT
economic activity
PDF
CABA - Diseño curricular para el ciclo básico - NES 2015
PPTX
Eoin brennan 2 g population density presentation
PDF
Guía de protección de datos personales en la red
nen
Videos digitales
Eldonian- rachel smith
Borrachos 2
Camara Oculta
Ulive2016
Carnestoltes
God S Pharmacy La Farmacia De Dios
LA ECONOMÍA
Fabrica De Zapatos De Moda En India
Economic Activity
Why study population?
Eldonian Village
Functional zones Dublin
economic activity
CABA - Diseño curricular para el ciclo básico - NES 2015
Eoin brennan 2 g population density presentation
Guía de protección de datos personales en la red
Ad

Similar to VI Editors (20)

PDF
Vi editor commands
PPTX
Using Vi Editor.pptx
PPTX
Using Vi Editor.pptx
DOC
58518522 study-aix
PDF
Quick-Start-UNIX.pdf
PDF
vim-cheatsheet.pdf
PDF
Using vi editor
PDF
Using VI Editor in Red Hat by Rohit Kumar
PPTX
Linux Basic commands and VI Editor
PDF
Vi cheat sheet
PDF
Vi cheat sheet
PDF
Beginning with vi text editor
PPTX
Linux Text Editor (Vi) Command List Summary
PPTX
Vi Vi Editor Unit 4 Power point presentation
PDF
Emacs Cheatsheet
PDF
Vim Cheat Sheet.pdf
PPT
Mastering the Linux vi Editor: Essential Commands and Techniques
PDF
Lesson 3 Working with Files in Linux
PDF
Cheatsheet: Hex file headers and regex
Vi editor commands
Using Vi Editor.pptx
Using Vi Editor.pptx
58518522 study-aix
Quick-Start-UNIX.pdf
vim-cheatsheet.pdf
Using vi editor
Using VI Editor in Red Hat by Rohit Kumar
Linux Basic commands and VI Editor
Vi cheat sheet
Vi cheat sheet
Beginning with vi text editor
Linux Text Editor (Vi) Command List Summary
Vi Vi Editor Unit 4 Power point presentation
Emacs Cheatsheet
Vim Cheat Sheet.pdf
Mastering the Linux vi Editor: Essential Commands and Techniques
Lesson 3 Working with Files in Linux
Cheatsheet: Hex file headers and regex

Recently uploaded (20)

PDF
Machine learning based COVID-19 study performance prediction
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPT
Teaching material agriculture food technology
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
A Presentation on Artificial Intelligence
Machine learning based COVID-19 study performance prediction
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
Advanced methodologies resolving dimensionality complications for autism neur...
Spectral efficient network and resource selection model in 5G networks
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
The Rise and Fall of 3GPP – Time for a Sabbatical?
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Teaching material agriculture food technology
Unlocking AI with Model Context Protocol (MCP)
Encapsulation_ Review paper, used for researhc scholars
Understanding_Digital_Forensics_Presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Reach Out and Touch Someone: Haptics and Empathic Computing
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
A Presentation on Artificial Intelligence

VI Editors

  • 1. Filename Completion in the C Shell csh will complete file names for if the filec shell variable is set set filec This will normally be in your .cshrc file Just type first part of name and press ESC Example: clyde% ls jerry john joe jimmy wesley tom bill willie ken ted shirley joan clyde%more jeESC clyde%more jerry shell types rest of name
  • 2. Filename Completion If the prefix is ambiguous, the shell can’t read your mind so it completes as much as it can and beeps You can then indicate what file you want, hit ESC again and the filename will be completed Or, you can type CTRL-D and the shell will list all possible matches
  • 3. Filename Completion Examples clyde% ls jerry john joe jimmy wesley tom bill willie ken ted shirley joan clyde% cat joESC cat jo hESC cat john clyde% cat joESC cat jo CTRL-D john joe joan cat jo
  • 4. Preparing for Exams (Subtitle: Learning Unix) Read the assigned readings in “Unix Primer Plus” Read about the commands and utilities in “UNIX in a Nutshell” Note that there are sections about the Unix shell , the Bourne shell , the C shell , vi, ex, sed , and awk as well as the shorter command descriptions in section 2 Read the handouts in the lab notes, Unix Editors, Redirection in Unix, Pattern Matching, and A printf Primer Experiment with the commands we discuss, use the man pages and the command descriptions in Section 2 of “Unix in a Nutshell” and try out the options and commands
  • 5. What Will Exams Be Like? First exam will be Monday, September 27th Exams will be comprehensive! Exams are closed book, closed notes, computer monitor OFF, closed mouth (although I will entertain questions), and closed neighbor’s paper When you are done, you may have a maximum of 10 minutes open book, notes, and computer ON (man pages, try things, whatever) I will then let you break while I (hopefully) get the papers graded We will then go over the exams before we wrap up for the evening
  • 6. ex - Yet Another Line Editor ex , just like ed , is a line editor ex is the line editor which vi , the visual editor, is based on This means that all of the ex commands are available from vi Using the ex commands within vi can often simplify tasks
  • 7. ex versus ed ed and ex have many similarities They both use line addresses They both use the same basic command set p, m, t, /expr/, ?expr?, r, w, q, d, u, ! command They also have some differences co as well as t for copy abbreviations sh to invoke a Unix shell set and setno : is the default command mode prompt
  • 8. Visual Editor - vi vi is a screen editor, the unit of change is character rather than a line vi is found on most Unix installations Unlike MS-Word, WordPerfect, or other word processors, vi files consist of plain ASCII text There are no special formatting codes Unfortunately, vi is so feature rich that it is complex to learn and takes considerable study and practice to master
  • 9. Starting vi Command line options vi invokes vi with a blank buffer vi file invokes vi on file or on a blank buffer using file for the name if file does not exist vi file1 file2... invokes vi on files sequentially vi -R file invokes vi on file in read-only mode view file invokes vi on file in read-only mode vi -r file recovers file and recent edits after a system crash (or at least tries!) vi + file opens file with cursor at last line vi +n file opens file with cursor at line n vi +/expr file opens file with cursor at expr
  • 10. vi Architecture vi is based on ex All ex commands are available from within vi Changing from vi to ex and back From vi command mode, a Q will switch to ex From ex command mode :vi will switch back to vi Like ed and ex , vi is modal Command and text entry modes
  • 11. vi Buffers vi is also based on memory buffers, like ed , changes are made to the buffer, not your file until a write is performed vi has three kinds of buffers the normal default buffer your edit file resides in the anonymous buffer, a special buffer used for copying text named 1-9 hold the last nine deletions a-z for storing copied text (like the Windows clipboard)
  • 12. Cursor Movement By Character h, j, k, l (  ,  ,  ,  ) By Text Objects w or W Forward a word b or B Backwards a word e or E End of word ) and ( Beginning of next, previous paragraph
  • 13. Movement by Lines 0, $ Beginning, end of current line ^ First character of current line (ignore spaces) +, - Next, previous line n Column n of current line H Top line of screen M Middle line of screen L Bottom line of screen n H n (number) of lines after top line n L n (number) of lines before bottom
  • 14. Command Multipliers Almost any command can be executed multiple times by using a command multiplier Examples: 4j moves down 4 lines 6w or 6W moves forward 6 words 10dd deletes 10 lines, starting with the current line 5x deletes 5 characters y4w copies 4 words to the anonymous buffer
  • 15. Screen Movement CTRL-F , CTRL-B Scroll forward/backwards one screen CTRL-D , CTRL-U Scroll down/up one-half screen CTRL-E , CTRL-Y Show one more line at bottom/top of window z RETURN Reposition current line to top of screen z. Reposition current line to middle of screen z- Reposition current line to bottom of screen
  • 16. Searches The search syntax in vi is similar to ed but only uses one search indicator /expr searches forward for expr ?expr searches backwards for expr n, N repeat last search in same, opposite direction /, ? repeat previous search forward, backward fx search forward for x on current line Fx search backwards for x on current line ; repeat previous current-line search , repeat previous current line search in opposite direction
  • 17. Using Line Numbers CTRL-G displays current line number n G Move to line number n G Move to last line in file : n Move to line number n
  • 18. Marking Lines As in ed, lines can be marked so you can refer to them in commands other than by line number m x Mark current cursor position as x :ma x Mark current line as x ` x Move cursor to x `` Return to previous mark ‘ x Move to beginning of line containing x ‘’ Return to beginning of line containing previous mark
  • 19. Inserting Text vi is more accommodating about inserting text in an empty file than ed All the insert commands work whether text exists or not i, a Insert text before/after cursor I, A Insert text at beginning/end of line o, O Open a new line for text below/above cursor
  • 20. Changing Text r replace character under cursor with next typed character ~ Change case of character under cursor cm Change text block defined by movement command m (cw or cL for word or line) cc Change current line C Change to end of line R Type over characters s Delete character and substitute typed text S Delete current line and substitute typed text Note: r and ~ leave you in command mode
  • 21. Deletions and Moves x Delete character under cursor X Delete character before cursor d m Delete text block defined by movement command m (dw or dL for delete word or line) dd Delete current line D Delete from cursor to end of line p Put deleted text before cursor P Put deleted text after cursor
  • 22. Yank and Put (Copy & Paste) Copying (Yanking) Text yy,Y Copy current line y m Copy text block defined by movement command m (yw or yL for word or line) Note: multipliers can be used, ie; y3w for yank 3 words or y10L for yank 10 lines Pasting (Put’ing) Text p, P Put yanked text after, before cursor
  • 23. Other Commands u, U Undo last edit, restore current line J Join current and next lines Note case of command (J vs j) . (period) Repeat last edit CTRL-L , Redraw Screen CTRL-R
  • 24. Reading :r newfile Read newfile into current edit file :r ! command Read the output of Unix command into current edit file :e! Return to version of current file at time of last write (discarding all changes since last write) :e file2 Edit file2 without leaving vi :e # Edit alternate file
  • 25. Writing :w Write (save) file :w! Write file (overriding file protection) :3,9w newfile Write lines 3 through 9 to newfile :3,9w>>file Write lines 3 through 9 appending to file :w%.new
  • 26. Exiting ZZ Write (save) and quit :x Write (save) and quit :wq Write (save) and quit :q Quit :q! Quit discarding any unsaved changes Q Quit vi and invoke ex :n Edit next file (if vi was started with the vi file1 file2 ... variant)