1 / 17

Chapter 5

Chapter 5. Using Linux Text Editors. Overview. Use Non-Graphical Linux Text Editors Graphical Text Editor. Overview. Configuration information is stored in a variety of text files, in the /etc directory Using a text editor to edit these files to customize the system. $ vi /etc/inittab.

damisi
Télécharger la présentation

Chapter 5

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 5 Using Linux Text Editors

  2. Overview • Use Non-Graphical Linux Text Editors • Graphical Text Editor

  3. Overview • Configuration information is stored in a variety of text files, in the /etc directory • Using a text editor to edit these files to customize the system. $ vi /etc/inittab

  4. Overview

  5. Using the vi Editor • Two versions of vi • vi • vim (Vi IMproved) • Replacing vi version on the most newer Linux distributions • Located in /bin • When execute the vi program, /usr/bin/vi file called • This is a symbolic link file, points to the /bin/vim executable file

  6. Using the vi Editor • Excute vi program by press vi or vim , to call /bin/vim

  7. vi Modes ■ Normal mode ■ Insert mode ■ Command mode ■ Replace mode • Default , vi opens file or creates a new file in normal mode • Command mode use to write, search, or close file

  8. vi Modes • Switch to Insert mode press I or S • Switch to Replace mode press <Insert> • Switch to Command mode press ESC and press : • Escape current mode press ESC

  9. Working in Normal mode • Open File to exec vi in normal mode vi vidu.txt • vi automatically switch from normal mode to insert mode when you enter text. • When you need to edit text : • Press ESC to switch to normal mode • Press dw, de, d$, dd, p, u, /search_term

  10. Entering Commands in vi Normal Mode ■ dwDeletes the word that comes immediately after the cursor, including the space following the word. The text is saved in a memory buffer. ■ de Deletes the word that comes immediately after the cursor, not including the space. The text is saved in a memory buffer.

  11. Entering Commands in vi Normal Mode ■ dd Deletes the entire current line. The text is saved in a memory buffer. ■ d$ Deletes from the insertion point to the end of the line. The text is saved in a memory buffer ■ p Inserts the text deleted in the last deletion operation after the current cursor location ■ u Undo the last action.

  12. Entering Commands in vi Normal Mode ■ CTRL-G Displays a status line at the bottom of the interface. This displays the name of the file, the total number of lines in the file, and the current cursor location. This is shown in Figure 5-15. ■ /search_term Searches for the instance of the term specified.

  13. Commands in Command mode ■ w and ENTER Writes the current file ■ w filename and ENTER Writes the current file to a different file name ■ exit and ENTER Writes the current file and then closes vi. Or press wq ■ q Closes vi without saving the current file. This can only be used if the file hasn’t been changed. If the file has been changed, then you must enter q!

  14. Using the vi Editor Exercise 5.1Page: 234

  15. Using the Emacs Editor Exercise 5.2Page: 241

  16. $ emacs

  17. Use Graphical Text Editors It work if: ■ The system is working properly. ■ The system has X Windows, a window manager, and a desktop installed. ■ Your X Window System has been configured properly to work with your hardware Some of graphic editors are : • Kate • X emacs • gedit

More Related