SlideShare a Scribd company logo
Lesson 4-Mastering the Visual Editor
Overview  Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating through a file. Adding text to a file. Avoiding confusion while entering commands to shell and vi.
Overview  Deleting text from a file. Undoing editing commands. Creating new files with the visual editor. Making changes to the text. Moving and copying text. Writing a file and quitting the editor.
Introducing the Visual Editor  Bill Joy, a student of the University of California, wrote the vi editor. The UNIX/Linux visual editor is a powerful, fast, command-driven screen editor. The vi visual editor is available on all systems and is an essential tool. The vi editor allows the movement of cursor to a specific location in a file.
Introducing the Visual Editor  The vi editor is present on every UNIX environment, uses few computing resources, and includes many tools. Standard UNIX releases include vi, and Linux provides vim, which includes some vi improvements. Command mode and append/insert are the two modes of the vi editor.
The command mode allows a user to access a file with basic vi commands. The append/insert mode allows a user to insert data characters in a file. Introducing the Visual Editor
Working in an Existing File with vi  Files are central to the UNIX computing environment. The visual editor is used to create new files and edit existing files. The vi editor does not permit text to be added directly when editing a file. The “cat” utility can be used for creating a file in UNIX.
We can edit the files created by the cat command. We can access/open the files by giving the "vi filename" command. The command will open the files in the command mode. Working in an Existing File with vi
Understanding the Visual Editor  Moving around in a file: Opening a file in vi allows a user to delete, move, copy and paste and save and quit the file. A user cannot insert characters while in the command mode. The fundamental way to move the cursor in a file is to do it with the direction keys.
Understanding the Visual Editor  Moving around in a file (continued): The vi editor interprets the h, j, k, and l keys as a command to the move the cursor in specific directions. The workstation either flashes or beeps if an attempt is made to move the cursor beyond the existing text.
Understanding the Visual Editor  Moving around in the file (continued): The vi editor also provides a forward search command for moving the cursor to a specific word in the text. The /text is the forward search command for moving the cursor to a specified text. The “n” command can be used for locating the next occurrence of a target string specified in the forward search command.
Understanding the Visual Editor  Working with text: To insert characters to the file, we have to change from the command mode to the insert/append mode. The vi editor provides the dd command for deleting an entire line of text from a file. The “dd” command even deletes blank lines.
Understanding the Visual Editor  Working with text (continued): After dd finishes deleting, it remains in the command mode. The “x” (x-out) command deletes only a single character under the cursor. The “a” command switches the vi editor from the command mode to the append mode and allows text to be entered to a file.
Understanding the Visual Editor  Working with text (continued): The “u” command undoes the last text change made to the file. The ESC key instructs the vi editor to switch from the append/insert mode to the command mode. A user can check the mode he is working in with the ESC key. The “o” command tells the editor to open a new blank line between the cursor line and the next line in the file.
Understanding the Visual Editor  Quitting the editor: The “wq” command instructs the editor to write the file and quit the editor. The “q” command can be used for quitting the editor if no changes are made to the file being edited. The “q!” command instructs the editor to quit without saving the changes made to the file.
Understanding the Visual Editor  Creating and reading a file in the editor: A new file can be created in the vi editor by specifying the filename with the vi command. A file opens in the command mode. Text can be entered by switching to the insert/append mode. The “r” or the “read” command locates a file and reads its contents into the current file, starting immediately after the cursor line.
Navigating Through a File  Using the direction keys: The arrow keys and the h, j, k, and l direction keys, either alone or in conjunction with the number keys, make it possible to move the cursor to any character in a file. The “set number” command tells the editor to display the line number on the screen. The commands “G” and “:$” instruct the editor to move to the last line of a file.
Navigating Through a File  Lowercase “n” or “/” (slash) can be used to instruct the vi editor to search forward, whereas uppercase N or ? (question mark) is used to search in the backward direction. The “set ignorecase” command can be used to switch off the case-sensitivity feature of vi’s search mechanism. The “set” command can be used to view the environmental features that are currently set.
Navigating Through a File  The “w” command can be used to advance the cursor to the beginning of the next word. The dollar sign ($) instructs the editor to move the cursor to the end of the current line. The caret (^) and the zero (0) move the cursor to the beginning of a line.
Navigating Through a File  Moving the Cursor in vi
Navigating Through a File  Moving to a Specific Textual Character in vi
Navigating Through a File  Moving the Cursor by Line Address and Location Display
Navigating Through a File  Two single quotation marks instruct the editor to return to the previous location in a file. The display adjustment commands are used to adjust the workstation’s screen display to move forward or backward to a different block or section of code, regardless of its context.
CTRL-F displays the next screen of a text file. CTRL-D scrolls down one half screen of a text file. CTRL-D scrolls up one half screen of a text file. CTRL-B displays the previous screen of a text file. Navigating Through a File
Adding Text to a File  The “i” (insert) command starts adding text to the left of the cursor. The “a” and “i” commands instruct the editor to move from the command mode to the append mode and start adding text at the cursor position. The “O” command is an instruction to open a line above the line where the cursor resides and shift to the append/insert mode.
Adding Text to a File  The “I” command instructs the editor to move the cursor to the beginning of a line and to change to the append mode. The “A” command moves the cursor to the end of a line and switches the editor to the append mode. The I and A command instructs the editor to switch to command mode.
Avoiding Confusion While Entering Commands to Shell and vi  The “who” command, when executed in a shell, lists the users currently logged on. In the vi’s command mode, it moves the cursor to a specific position and moves over to the append mode. In vi’s append mode, the characters are entered directly into the file being edited.
Deleting Text From a File  Multiple lines, words, and characters can be deleted by prefacing the delete command with a number. The uppercase “D” command instructs the editor to delete the remainder of the line starting from the character under the cursor. The “df*” command deletes the text from the cursor to the first character * on the current line to the right of the cursor.
Deleting Text From a File  The vi editor also allows lines to be deleted using the line number addresses. The d command also allows a comma to be used for specifying a range of lines to be deleted. Commands that employ line addresses require the ENTER key to be pressed after the command for execution.
Undoing Editing Commands  The “u” command undoes the last editing change in the file. The vi editor in Linux allows multiple changes to be undone. The “U” command undoes any number of changes made to the current line where the cursor is located.
Creating New Files with the Visual  Editor  The vi filename command is used for creating a new file as well as editing an existing file. The vi makes a buffer copy of a file if it exists, else it starts editing a memory buffer using the new filename. A file created in vi can be made executable by executing the chmod command.
Making Changes to the Text The “r” command instructs the editor to replace the character located under the cursor with the very next character typed in by the user. It can also be used for breaking up a long line into parts. The uppercase “J” command can be used for joining two lines of text.
Making Changes to the Text The “R” command switches the editor to the “type-over” mode, wherein each letter typed replaces the character under the cursor as it moves down the line. The “s” command substitutes the character under the cursor with the text typed in by the user until the ESC key is pressed. The “cw” (change word) command allows a user to substitute a word or multitude of words for a single word.
Making Changes to the Text The “cc” command deletes the text from the current line and moves you from the command mode to the append mode. The “C” command puts the editor into the append mode and allows a user to change part of the line from the cursor position to the end of the line. The substitute command, a colon command, is used to exchange one regular expression for another in a file.
Making Changes to the Text The substitute command requires two words to be separated by slashes. The “g” at the end of the substitute command is a flag and can be used for replacing all occurrences of the target pattern with the addressed lines. The substitute command can also be restricted to lines having specific content.
Moving and Copying Text  The “yy” command instructs the editor to copy the contents of the line where the cursor resides. The “p” or “P” command is used for pasting a new line in a new location below the cursor line. The dd and p commands can be combined to perform a cut and paste operation.
Moving and Copying Text  Commands to Move and Copy Text
Moving and Copying Text  Marking a place in the file: The “m*” command instructs the editor to mark a line of text and assign it a label specified in the *; it can have a value from a to z. A single quote character with the label name can be used for moving on to a specific label. Vi allows deleting, changing, and yanking of text from the current position to the marked spot.
Moving and Copying Text  The delete, change, and yank commands
Moving and Copying Text  Marking a place in the file (continued): The mark command can also be used for simplifying the tasks of deleting, moving, and copying large blocks of text by marking both ends of the block. Marking text is a powerful way to identify lines to delete, move, or copy. The move or copy commands can be used for moving or copying a block of text specified using line numbers.
Writing a File and Quitting the  Editor  The “w” command can be used for saving a copy of the current file to a new file. The w or write command can also be used for writing a part or block of text from the current file to a new file.
The “w!” command instructs the editor to overwrite the contents of the file if it exists, else creates a new file for saving the contents of the current file. The >> symbol, when specified with the w command, appends the text to the file specified. Writing a File and Quitting the  Editor
Summary  The vi is the editor used to create and edit files. Vi provides several utilities to edit text. Append/insert and command are the two modes of the vi editor. Files created in the cat command can be opened in vi.
Summary  A user cannot insert data without switching to the append/insert mode. The I, a, i, A, o, and O commands instruct the editor to add text relative to the cursor position. The vi editor provides the change (c), yank (y), and delete (d) operators for text operations.
Summary  The vi provides various utilities to move, edit, delete, and replace text. The :wq is used for saving and quitting the editor. The vi editor facilitates global changes, where the user specifies the target for replacement and the replacement text. Linux provides an advanced version of the vi, namely the vim editor.

More Related Content

What's hot (20)

PPT
intro unix/linux 09
duquoi
 
ODP
Linuxs1
rajikaa
 
PDF
08. handling file streams
Haresh Jaiswal
 
PPT
Spsl unit1
Sasidhar Kothuru
 
PPTX
Shell scripting
DeepakKumar4980
 
DOCX
File handling in c++
Daniel Nyagechi
 
PPT
working file handling in cpp overview
gourav kottawar
 
ODP
Linux
merlin deepika
 
PPT
Filehandlinging cp2
Tanmay Baranwal
 
PPT
Spsl by sasidhar 3 unit
Sasidhar Kothuru
 
PPT
File handling in_c
sanya6900
 
PPT
File handling in C++
Hitesh Kumar
 
PPTX
2CPP17 - File IO
Michael Heron
 
PDF
C++ Files and Streams
Ahmed Farag
 
PPT
File in cpp 2016
Dr .Ahmed Tawwab
 
intro unix/linux 09
duquoi
 
Linuxs1
rajikaa
 
08. handling file streams
Haresh Jaiswal
 
Spsl unit1
Sasidhar Kothuru
 
Shell scripting
DeepakKumar4980
 
File handling in c++
Daniel Nyagechi
 
working file handling in cpp overview
gourav kottawar
 
Filehandlinging cp2
Tanmay Baranwal
 
Spsl by sasidhar 3 unit
Sasidhar Kothuru
 
File handling in_c
sanya6900
 
File handling in C++
Hitesh Kumar
 
2CPP17 - File IO
Michael Heron
 
C++ Files and Streams
Ahmed Farag
 
File in cpp 2016
Dr .Ahmed Tawwab
 

Similar to intro unix/linux 04 (20)

PDF
1_Editors_in_Unix
Gautam Raja
 
PPTX
Vi editor
Ramakrishna kapa
 
PPTX
Vi Vi Editor Unit 4 Power point presentation
jatinlntcdc
 
PPTX
Linux Text Editor (Vi) Command List Summary
minzo1988minzawoo
 
DOC
Qc document draft
gourabehera
 
PDF
Vi Editor
Shiwang Kalkhanda
 
PPT
VI Editors
Deivanai
 
PPT
07 vi text_editor
Shay Cohen
 
PPT
Vi editor in linux
Bhumivaghasiya
 
PPTX
Vi editor
Nidhi Sharma
 
PDF
Linux text editors
InfoExcavator
 
PDF
Linux text editors Vim nano
Md Meherab Hossen
 
PPTX
VI editor in unix
Ahmed Fayyaz
 
PDF
Using VI Editor in Red Hat by Rohit Kumar
Rohit Kumar
 
PDF
Using vi editor
Rohit Kumar
 
PDF
Vi editor Linux Editors
TONO KURIAKOSE
 
PPTX
lectuer 21-22.pptx
poonam256394
 
PPTX
VI Editor - R.D.Sivakumar
Sivakumar R D .
 
PDF
Vi editor commands
Femi Adeyemi
 
PPT
Introduction to vi editor
U.P Police
 
1_Editors_in_Unix
Gautam Raja
 
Vi editor
Ramakrishna kapa
 
Vi Vi Editor Unit 4 Power point presentation
jatinlntcdc
 
Linux Text Editor (Vi) Command List Summary
minzo1988minzawoo
 
Qc document draft
gourabehera
 
VI Editors
Deivanai
 
07 vi text_editor
Shay Cohen
 
Vi editor in linux
Bhumivaghasiya
 
Vi editor
Nidhi Sharma
 
Linux text editors
InfoExcavator
 
Linux text editors Vim nano
Md Meherab Hossen
 
VI editor in unix
Ahmed Fayyaz
 
Using VI Editor in Red Hat by Rohit Kumar
Rohit Kumar
 
Using vi editor
Rohit Kumar
 
Vi editor Linux Editors
TONO KURIAKOSE
 
lectuer 21-22.pptx
poonam256394
 
VI Editor - R.D.Sivakumar
Sivakumar R D .
 
Vi editor commands
Femi Adeyemi
 
Introduction to vi editor
U.P Police
 
Ad

More from duquoi (9)

PDF
Troubleshooting CD Burning
duquoi
 
PDF
Advanced Bash Scripting Guide 2002
duquoi
 
PDF
Astrolog: Switches
duquoi
 
PDF
Cinelerra Video Editing Manual
duquoi
 
PDF
Iptables
duquoi
 
PDF
Ffmpeg
duquoi
 
ODP
rosegarden
duquoi
 
PPT
intro unix/linux 12
duquoi
 
PPT
intro unix/linux 01
duquoi
 
Troubleshooting CD Burning
duquoi
 
Advanced Bash Scripting Guide 2002
duquoi
 
Astrolog: Switches
duquoi
 
Cinelerra Video Editing Manual
duquoi
 
Iptables
duquoi
 
Ffmpeg
duquoi
 
rosegarden
duquoi
 
intro unix/linux 12
duquoi
 
intro unix/linux 01
duquoi
 
Ad

Recently uploaded (20)

PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
PDF
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PDF
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
PDF
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
CIFDAQ Token Spotlight for 9th July 2025
CIFDAQ
 
NewMind AI - Journal 100 Insights After The 100th Issue
NewMind AI
 
Python basic programing language for automation
DanialHabibi2
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
July Patch Tuesday
Ivanti
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Exolore The Essential AI Tools in 2025.pdf
Srinivasan M
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
The Builder’s Playbook - 2025 State of AI Report.pdf
jeroen339954
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Chris Elwell Woburn, MA - Passionate About IT Innovation
Chris Elwell Woburn, MA
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 

intro unix/linux 04

  • 1. Lesson 4-Mastering the Visual Editor
  • 2. Overview Introducing the visual editor. Working in an existing file with vi. Understanding the visual editor. Navigating through a file. Adding text to a file. Avoiding confusion while entering commands to shell and vi.
  • 3. Overview Deleting text from a file. Undoing editing commands. Creating new files with the visual editor. Making changes to the text. Moving and copying text. Writing a file and quitting the editor.
  • 4. Introducing the Visual Editor Bill Joy, a student of the University of California, wrote the vi editor. The UNIX/Linux visual editor is a powerful, fast, command-driven screen editor. The vi visual editor is available on all systems and is an essential tool. The vi editor allows the movement of cursor to a specific location in a file.
  • 5. Introducing the Visual Editor The vi editor is present on every UNIX environment, uses few computing resources, and includes many tools. Standard UNIX releases include vi, and Linux provides vim, which includes some vi improvements. Command mode and append/insert are the two modes of the vi editor.
  • 6. The command mode allows a user to access a file with basic vi commands. The append/insert mode allows a user to insert data characters in a file. Introducing the Visual Editor
  • 7. Working in an Existing File with vi Files are central to the UNIX computing environment. The visual editor is used to create new files and edit existing files. The vi editor does not permit text to be added directly when editing a file. The “cat” utility can be used for creating a file in UNIX.
  • 8. We can edit the files created by the cat command. We can access/open the files by giving the "vi filename" command. The command will open the files in the command mode. Working in an Existing File with vi
  • 9. Understanding the Visual Editor Moving around in a file: Opening a file in vi allows a user to delete, move, copy and paste and save and quit the file. A user cannot insert characters while in the command mode. The fundamental way to move the cursor in a file is to do it with the direction keys.
  • 10. Understanding the Visual Editor Moving around in a file (continued): The vi editor interprets the h, j, k, and l keys as a command to the move the cursor in specific directions. The workstation either flashes or beeps if an attempt is made to move the cursor beyond the existing text.
  • 11. Understanding the Visual Editor Moving around in the file (continued): The vi editor also provides a forward search command for moving the cursor to a specific word in the text. The /text is the forward search command for moving the cursor to a specified text. The “n” command can be used for locating the next occurrence of a target string specified in the forward search command.
  • 12. Understanding the Visual Editor Working with text: To insert characters to the file, we have to change from the command mode to the insert/append mode. The vi editor provides the dd command for deleting an entire line of text from a file. The “dd” command even deletes blank lines.
  • 13. Understanding the Visual Editor Working with text (continued): After dd finishes deleting, it remains in the command mode. The “x” (x-out) command deletes only a single character under the cursor. The “a” command switches the vi editor from the command mode to the append mode and allows text to be entered to a file.
  • 14. Understanding the Visual Editor Working with text (continued): The “u” command undoes the last text change made to the file. The ESC key instructs the vi editor to switch from the append/insert mode to the command mode. A user can check the mode he is working in with the ESC key. The “o” command tells the editor to open a new blank line between the cursor line and the next line in the file.
  • 15. Understanding the Visual Editor Quitting the editor: The “wq” command instructs the editor to write the file and quit the editor. The “q” command can be used for quitting the editor if no changes are made to the file being edited. The “q!” command instructs the editor to quit without saving the changes made to the file.
  • 16. Understanding the Visual Editor Creating and reading a file in the editor: A new file can be created in the vi editor by specifying the filename with the vi command. A file opens in the command mode. Text can be entered by switching to the insert/append mode. The “r” or the “read” command locates a file and reads its contents into the current file, starting immediately after the cursor line.
  • 17. Navigating Through a File Using the direction keys: The arrow keys and the h, j, k, and l direction keys, either alone or in conjunction with the number keys, make it possible to move the cursor to any character in a file. The “set number” command tells the editor to display the line number on the screen. The commands “G” and “:$” instruct the editor to move to the last line of a file.
  • 18. Navigating Through a File Lowercase “n” or “/” (slash) can be used to instruct the vi editor to search forward, whereas uppercase N or ? (question mark) is used to search in the backward direction. The “set ignorecase” command can be used to switch off the case-sensitivity feature of vi’s search mechanism. The “set” command can be used to view the environmental features that are currently set.
  • 19. Navigating Through a File The “w” command can be used to advance the cursor to the beginning of the next word. The dollar sign ($) instructs the editor to move the cursor to the end of the current line. The caret (^) and the zero (0) move the cursor to the beginning of a line.
  • 20. Navigating Through a File Moving the Cursor in vi
  • 21. Navigating Through a File Moving to a Specific Textual Character in vi
  • 22. Navigating Through a File Moving the Cursor by Line Address and Location Display
  • 23. Navigating Through a File Two single quotation marks instruct the editor to return to the previous location in a file. The display adjustment commands are used to adjust the workstation’s screen display to move forward or backward to a different block or section of code, regardless of its context.
  • 24. CTRL-F displays the next screen of a text file. CTRL-D scrolls down one half screen of a text file. CTRL-D scrolls up one half screen of a text file. CTRL-B displays the previous screen of a text file. Navigating Through a File
  • 25. Adding Text to a File The “i” (insert) command starts adding text to the left of the cursor. The “a” and “i” commands instruct the editor to move from the command mode to the append mode and start adding text at the cursor position. The “O” command is an instruction to open a line above the line where the cursor resides and shift to the append/insert mode.
  • 26. Adding Text to a File The “I” command instructs the editor to move the cursor to the beginning of a line and to change to the append mode. The “A” command moves the cursor to the end of a line and switches the editor to the append mode. The I and A command instructs the editor to switch to command mode.
  • 27. Avoiding Confusion While Entering Commands to Shell and vi The “who” command, when executed in a shell, lists the users currently logged on. In the vi’s command mode, it moves the cursor to a specific position and moves over to the append mode. In vi’s append mode, the characters are entered directly into the file being edited.
  • 28. Deleting Text From a File Multiple lines, words, and characters can be deleted by prefacing the delete command with a number. The uppercase “D” command instructs the editor to delete the remainder of the line starting from the character under the cursor. The “df*” command deletes the text from the cursor to the first character * on the current line to the right of the cursor.
  • 29. Deleting Text From a File The vi editor also allows lines to be deleted using the line number addresses. The d command also allows a comma to be used for specifying a range of lines to be deleted. Commands that employ line addresses require the ENTER key to be pressed after the command for execution.
  • 30. Undoing Editing Commands The “u” command undoes the last editing change in the file. The vi editor in Linux allows multiple changes to be undone. The “U” command undoes any number of changes made to the current line where the cursor is located.
  • 31. Creating New Files with the Visual Editor The vi filename command is used for creating a new file as well as editing an existing file. The vi makes a buffer copy of a file if it exists, else it starts editing a memory buffer using the new filename. A file created in vi can be made executable by executing the chmod command.
  • 32. Making Changes to the Text The “r” command instructs the editor to replace the character located under the cursor with the very next character typed in by the user. It can also be used for breaking up a long line into parts. The uppercase “J” command can be used for joining two lines of text.
  • 33. Making Changes to the Text The “R” command switches the editor to the “type-over” mode, wherein each letter typed replaces the character under the cursor as it moves down the line. The “s” command substitutes the character under the cursor with the text typed in by the user until the ESC key is pressed. The “cw” (change word) command allows a user to substitute a word or multitude of words for a single word.
  • 34. Making Changes to the Text The “cc” command deletes the text from the current line and moves you from the command mode to the append mode. The “C” command puts the editor into the append mode and allows a user to change part of the line from the cursor position to the end of the line. The substitute command, a colon command, is used to exchange one regular expression for another in a file.
  • 35. Making Changes to the Text The substitute command requires two words to be separated by slashes. The “g” at the end of the substitute command is a flag and can be used for replacing all occurrences of the target pattern with the addressed lines. The substitute command can also be restricted to lines having specific content.
  • 36. Moving and Copying Text The “yy” command instructs the editor to copy the contents of the line where the cursor resides. The “p” or “P” command is used for pasting a new line in a new location below the cursor line. The dd and p commands can be combined to perform a cut and paste operation.
  • 37. Moving and Copying Text Commands to Move and Copy Text
  • 38. Moving and Copying Text Marking a place in the file: The “m*” command instructs the editor to mark a line of text and assign it a label specified in the *; it can have a value from a to z. A single quote character with the label name can be used for moving on to a specific label. Vi allows deleting, changing, and yanking of text from the current position to the marked spot.
  • 39. Moving and Copying Text The delete, change, and yank commands
  • 40. Moving and Copying Text Marking a place in the file (continued): The mark command can also be used for simplifying the tasks of deleting, moving, and copying large blocks of text by marking both ends of the block. Marking text is a powerful way to identify lines to delete, move, or copy. The move or copy commands can be used for moving or copying a block of text specified using line numbers.
  • 41. Writing a File and Quitting the Editor The “w” command can be used for saving a copy of the current file to a new file. The w or write command can also be used for writing a part or block of text from the current file to a new file.
  • 42. The “w!” command instructs the editor to overwrite the contents of the file if it exists, else creates a new file for saving the contents of the current file. The >> symbol, when specified with the w command, appends the text to the file specified. Writing a File and Quitting the Editor
  • 43. Summary The vi is the editor used to create and edit files. Vi provides several utilities to edit text. Append/insert and command are the two modes of the vi editor. Files created in the cat command can be opened in vi.
  • 44. Summary A user cannot insert data without switching to the append/insert mode. The I, a, i, A, o, and O commands instruct the editor to add text relative to the cursor position. The vi editor provides the change (c), yank (y), and delete (d) operators for text operations.
  • 45. Summary The vi provides various utilities to move, edit, delete, and replace text. The :wq is used for saving and quitting the editor. The vi editor facilitates global changes, where the user specifies the target for replacement and the replacement text. Linux provides an advanced version of the vi, namely the vim editor.