Linux

  1. Home
  2. Computing & Technology
  3. Linux

Tutorial: Files and Folders On Your Linux Desktop

6. Using A Text Editor

By Juergen Haas, About.com

Very often it is necessary to use the computer to input some text or to modify the data in a text file. While a full-fledged word processor like OpenOffice.org's Writer may be used, it can be an overkill since the sophisticated features and formatting available with a word processor are not needed in many cases. A text editor can be used instead. The Linux system comes installed with many text editors. In this section we shall be looking at how to use a text editor which comes with the GNOME Desktop - gedit.

Note:
A text file here refers to a a file which contains pure text printing characters only. Some types of files e.g. those created by a word processor, while appearing to be text-only actually contain other non-printing characters and hence are not pure-text files.

Starting Gedit

Gedit may be started from the Main Menu,

Main Menu --> Accessories --> Text Editor

Click to view screen shot Fig 3.4 The Gedit Text Editor

After gedit has started, you can immediately type in text into the main edit window. The mouse is also used extensively in gedit, to move around the document as well as to perform editing functions.

Inputing Text

Text can be entered by simply typing into the main gedit window. By default the text will wrap to the next line when it reaches the border of the editing window.

Marking Text

The mouse may be used to mark a block of text by clicking on the beginning of the block and dragging the mouse to the end of the block before releasing it.

Deleting Text

Text can be deleted one character at a time by moving the mouse to the character in question and using the DELETE and BACKSPACE keys in the normal fashion. If there is a lot of text to be deleted, a more efficient way to delete text is to mark it first and then press the DELETE key on the keyboard.

Copy, Cut and Paste

Text can be edited by marking it first and then selecting Cut, or Copy from the buttons at the top. "Cutting" will result in the marked text being copied into a storage buffer and then deleted from the editing window, while "Copying" will result in just a copy of the text being copied into the storage buffer without the deletion of the original text. The text cut/copied in this way can then be pasted into another part of the document by moving the mouse to the desired location and selecting the Paste button at the top.

Another way of invoking these functions is to click on the Edit option on the top menu bar and selecting the desired function, e.g.
Edit --> Cut
Edit --> Copy
Edit --> Paste

Undo

After performing an editing function, e.g. deleting a block of text, you can undo the action by clicking on the Undo button at the top. The Undo function can also be invoked using the Edit menu selection at the top.

Saving Text

The text typed in can be saved by clicking on the File option on the main menu bar at the top and selecting,

File --> Save As ...

Move to the folder you want to save the file in and enter the name of the file to save.

Find and Replace

The Find button can be used to locate a text string. By default this search is not case sensitive and will also locate the text if it is part of a word. These default options can be changed from the Find dialog.

The Replace button can be used to locate a text string and replacing it with another. Again the default options of non-case sensitive and matching part of a word can be changed.

The Find and Replace functions can also be performed using the Search menu selection at the top.

Opening A File

You can edit a text document already saved on the system by opening it. From the main menu at the top choose,

File --> Open

and select the file to open.

Preferences

Preferences can be set from the Preferences menu selection,

Edit --> Preferences

The Preferences you can set include the font, colour and point size to be used, tab spacing, autowrapping, and autoindenting.

Help

More information on how to use gedit can be obtained by selecting Help from the menu at the top.

Exercises

1. Use the gedit text editor to type in the first page of this guide. Save the document in a file on your home folder.

2. Open the saved file and edit it by:

  • deleting the second paragraph on page one
  • adding the statement “End of Chapter” to the last page
  • save the edited document as a new file

---------------------------------------

You are reading
Tutorial: Files and Folders On Your Linux Desktop
1. The File System
2. Ownerships and Permissions
3. Using the File Manager
4. Accessing Files and Programs
5. The Trash Can
6. Using A Text Editor

| Previous Tutorial | Lists of Tutorials | Next Tutorial |

Explore Linux

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Linux

  1. Home
  2. Computing & Technology
  3. Linux
  4. Linux 101
  5. Linux Tutorial - Using A Text Editor

©2009 About.com, a part of The New York Times Company.

All rights reserved.