1 / 36

Linux Operations and Administration

Linux Operations and Administration. Professor Sabol. Objectives. Describe key features of GUI and command-line text editors available in Linux Use the vim editor to create and edit text files. Text Editors in Linux. Text editor Program used to create and edit plain text files

rburgess
Download Presentation

Linux Operations and Administration

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. Linux Operations and Administration Professor Sabol

  2. Objectives • Describe key features of GUI and command-line text editors available in Linux • Use the vim editor to create and edit text files

  3. Text Editors in Linux • Text editor • Program used to create and edit plain text files • Not same as word processor • Main purpose: to create a file to be used by another program, for example: • Hypertext Markup Language (HTML) for a Web browser • Source code that a compiler can process • Shell script • Text file containing a sequence of commands

  4. Text Editors in Linux (cont’d.) • Two types of text editors: • Command-line editors • GUI editors

  5. GUI Text Editors in Linux • Linux GUI text editors • Similar to Notepad in Windows • Advantage: • Select and edit text quickly with the mouse • Widely used GUI text editors: • KWrite • Gedit

  6. KWrite: A GUI Text Editor for KDE • Also called programmer’s editor for the K Desktop Environment • To start: • Type kwrite at a command prompt • Opens a new empty file in Kwrite • Use Kickoff Application Launcher button • Advanced features: • Syntax highlighting to display text in different colors and fonts for programming languages • Bookmarks are markers placed on certain lines to help navigate through a text file

  7. KWrite: A GUI Text Editor for KDE (cont’d.) Figure 4-1 KDE’s KWrite text editor

  8. KWrite: A GUI Text Editor for KDE (cont’d.) • Activity 4-1: Exploring the KWrite Text Editor • Explore features of the KWrite text editor

  9. Gedit: A GUI Text Editor for GNOME • GUI text editor included with GNOME • To start • Open a terminal window, type gedit, and press Enter • Syntax highlighting options • Plain text • Sources • Scripts • Others • Markup • Scientific

  10. Gedit: A GUI Text Editor for GNOME (cont’d.) Figure 4-2 GNOME’s gedit text editor

  11. Gedit: A GUI Text Editor for GNOME (cont’d.) • Activity 4-2: Exploring the Gedit Text Editor • Learn features of the Gedit text editor

  12. Getting Started with the Vim Editor • vi command-line text editor • Included with most versions of UNIX and Linux • Learning curve • Knowing how to use it is crucial • vi has evolved into many different forms • vim • Stands for “vi improved” • vi command is now linked to the vim command

  13. Getting Started with the Vim Editor (cont’d.) • Modular editor • Runs in different operational modes • Command mode • Use key combinations as commands instead of typing text • Insert mode • Typed text is displayed onscreen • Extend mode • Used for more advanced commands, such as saving files, exiting vim, or searching and replacing text

  14. Starting Vim • Type vim and press Enter • Type vim filename and press Enter • If the file doesn’t exist, vim creates an empty file with this filename • Figure 4-3 • Window displayed after you start vim • Tilde (~) • Represents blank or empty lines in the file

  15. Starting Vim (cont’d.) The vim text editor

  16. Command Mode • Command mode • Chosen automatically when starting vim • Table 4-1 • Advanced navigational commands in vim

  17. Table 4-1 Advanced vim navigational commands Linux Operations and Administration

  18. Table 4-1 Advanced vim navigational commands (continued ) Linux Operations and Administration 18

  19. Command Mode (cont’d.) • Activity 4-3: Using Vim in Command Mode • Use navigational commands in vim

  20. Insert Mode • Must be in insert mode to type text • Change to insert mode with one of the commands in Table 4-2 • vim editor displays -- INSERT -- at the lower left • To indicate insert mode • Press the Esc key to change back to command mode

  21. Insert Mode (cont’d.) Table 4-2 Commands for entering insert mode

  22. Insert Mode (cont’d.) Figure 4-4 The vim editor in insert mode

  23. Modifying Text • Modify text using the keyboard instead of the mouse • Table 4-3 • Commands for modifying text in vim • Must be in command mode • Activity 4-4: Using Vim in Insert Mode • Change to insert mode and modify text in vim

  24. Modifying Text (cont’d.) Table 4-3 Commands for modifying text

  25. Deleting Text • Table 4-4 • Lists commands for deleting text in vim

  26. Deleting Text (cont’d.) Table 4-4 Commands for deleting text

  27. Cut, Yank, and Paste • Cut text • Store text in a buffer • Paste text • Move from buffer to cursor location • Yank (copy) text • Keep in current location and copy to buffer • Table 4-5 • Commands used to yank and paste text in vim

  28. Cut, Yank, and Paste (cont’d.) Table 4-5 Commands for yanking and pasting text

  29. Undo Commands • Undo changes • Type u • Keep typing u until you have reached your oldest change • Activity 4-5: Modifying Text in Vim • Delete, cut, copy, and paste text in vim

  30. Extended Mode • Offers advanced features • Save and quit • Search and replace • Customization options • Enter extended mode • Type the : symbol • Table 4-6 • Describes commands for saving files and exiting vim

  31. Extended Mode (cont’d.) Table 4-6 Extended mode commands for saving and exiting

  32. Extended Mode (cont’d.) Table 4-7 Extended mode commands to search for and replace text

  33. Useful Commands • Table 4-8 • Commands for extended mode • Activity 4-6: Using Vim in Extended Mode • Use vim commands in extended mode

  34. Useful Commands (cont’d.) Table 4-8 Additional extended mode commands

  35. Summary • Linux GUI text editors • Easy to use • Comparable with Windows Notepad • vim text editor • Available with every major distribution of UNIX and Linux • Operates in several different modes • Insert mode • Command mode • Extended mode

  36. Summary (cont’d.) • Command-line text editor • Use a variety of keys and key combinations in vim to perform operations

More Related