How to Edit Text Files Using the gEdit Linux Text Editor

gEdit is a Linux text editor commonly deployed as part of the GNOME desktop environment.

Most Linux guides and tutorials will get you to use the nano editor or vi to edit text files and configuration files and the reason for this is that nano and vi are almost guaranteed to be installed as part of the Linux operating system.

The gEdit editor is much easier to use than nano and vi however and works in much the same way as the Microsoft Windows Notepad.

How to Start gEdit

If you are running a distribution with the GNOME desktop environment press the super key (the key with the Windows logo on it, next to the ALT key).

Type "Edit" into the search bar and an icon for "Text Editor" will appear. Select this icon.

Text Editor

You can also open files within gEdit in the following way:

  • Open the Nautilus file manager
  • Navigate to the folder with the file you wish to open
  • Right click on the file.
  • If there is an option to "open with text editor" click on this link otherwise click "open with other application" and choose the "text editor" option.

Finally, you can also edit files in gEdit from the command line. Simply open a terminal and type the following command:


To open a specific file you can specify the filename after the gedit command as follows:

gedit /path/to/file
Linux Gedit open from CLI

It is better to run the gedit command as a background command so that the cursor returns to the terminal after you have executed the command to open it. In order to run a program in the background you add the ampersand symbol as follows:

gedit &

The gEdit User Interface

The gEdit user interface contains a single toolbar at the top with a panel for entering the text below it.

The toolbar contains the following items:

  • Open
  • Add a tab
  • Save
  • Options
  • Minimize
  • Maximize
  • Close

Selecting Open pulls up a window with a search bar for searching for documents, a list of recently accessed documents and the option to access Other Documents.

When you press Other Documents, a file dialog will appear where you can search through the directory structure for the file you wish to open.

Other Documents button in gEdit

There is a plus symbol (+) next to Open. When you select it, a new tab is added. This means you can edit multiple documents at the same time.

Plus tab in Text Editor

Save displays the file dialog and you can choose wherein the file system to save the file. You can also choose the character encoding and the file type.

The Options icon is denoted by three vertical lines. When selected it brings up a new menu with the following options:

  • Refresh
  • Print
  • Fullscreen
  • Save As
  • Save All
  • Find
  • Find and Replace
  • Clear Highlight
  • Go to line
  • View -> Side Panel
  • View -> Highlight Mode
  • Tools -> Check spelling
  • Tools -> Set Language
  • Tools -> Highlight misspelled words
  • Tools -> Insert date and time
  • Tools -> Statistics
  • Preferences
  • Help
  • About
  • Close All
  • Close
  • Quit

The other three icons let you minimize, maximize or close the editor.

Linux gedit options

Refresh the Document

Refresh can be found on the Options menu. 

It will not be enabled unless the document you are editing has changed since you first loaded it.

If a file changes after you have loaded it a message will appear on the screen asking you whether you wish to reload it.

Print a Document

The Print icon on the Options menu brings up the print settings screen, and you can choose to print the document to a file or printer.

Display a Document Full Screen

The "full screen" icon on the "options" menu displays the gEdit window as a full-screen window and hides the toolbar.

You can turn off full-screen mode by hovering your mouse over the top of the window and clicking the full-screen icon again on the menu.

Save Documents

The Save as menu item on the Options menu shows the file save dialog and you can choose where to save the file.

The Save All menu item saves all the files open on all the tabs.

Searching for Text

The Find menu item can be found on the Options menu. 

Linux gedit find

Selecting the Find menu item brings up a search bar. You can enter the text to search for and choose the direction to search (up or down the page).

The Find and replace menu item brings up a window where you can search for the text to search for and enter the text you wish to replace it with. You can also match by case, search backward, match the entire word only, wrap around and use regular expressions. The options on this screen let you find, replace or replace all matched entries.

Clear Highlighted Text

The Clear Highlight menu item can be found on the Options menu. This clears selected text which has been highlighted using the "find" option.

Go to a Specific Line

To go to a specific line select the Go To Line menu item on the Options menu.

A small window opens which lets you enter the line number you wish to go to.

Linux gedit go to line

In the event that the line number you enter is longer than the file, the cursor will be moved to the bottom of the document.

Display a Side Panel

Under the "options" menu there is a sub-menu called "view" and under that, there is an option to display or hide the side panel.

The side panel shows a list of open documents. You can view each document simply by clicking on it.

Highlight Text

It is possible to highlight text depending on the type of document you are creating.

From the Options menu choose the View menu, then Highlight Mode.

A list of possible modes appear. For example, you will see options for many programming languages including Perl, Python, Java, C, VBScript, Actionscript and many more.

The text is highlighted using the keywords for the language chosen.

For example, if you chose SQL as the highlight mode then a script might look something like this:

select * from tablename where x = 1

Set the Language

To set the language of the document open the Options menu. Then, from the Tools sub-menu, choose Set Language.

You can choose from a number of different languages.

Check the Spelling

To spell-check a document, open the Options menu and from the Tools menu, choose Check Spelling.

When a word has an incorrect spelling a list of suggestions will be displayed. You can choose to ignore, ignore all, change or change all occurrences of the incorrect word.

There is another option on the Tools menu called Highlight misspelled words. When checked any incorrectly spelled words will be highlighted.

Insert the Date and Time

You can insert the date and time into a document by selecting the Options menu, followed by the Tools menu. Then, choose Insert date and time.

Linux gedit date and time

A window will appear from which you can choose the format for the date and time.

Get Statistics for Your Document

Under the Options menu and then the Tools sub-menu there is an option called Statistics.

This shows a new window with the following statistics:

  • Number of lines
  • Number of words
  • Number of characters (with spaces)
  • Number of characters (without spaces)
  • Bytes


To pull up the preferences, select the Options menu, then Preferences.

A window appears with 4 tabs:

  • View
  • Editor
  • Fonts And Colours
  • Plugins

The view tab lets you choose whether to display line numbers, a right margin, a status bar, an overview map and/or a grid pattern.

You can also determine whether word wrap is turned on or off and whether a single word splits over multiple lines.

There are also options for how highlighting works.

The editor tab lets you determine how many spaces make up a tab and whether to insert spaces instead of tabs.

You can also determine how often a file is auto-saved.

The fonts and colors tab lets you choose the theme used by gEdit as well as the default font family and size.


There are a number of plugins available for gEdit. 

On the preferences, screen select the Plugins tab.

Plugins tab in Preferences

Some of them are already highlighted but enable others by placing a check in the box. 

The plugins available are as follows:

  • Document statistics
  • External tools
  • File browser panel
  • Insert date/time
  • Modelines
  • Python console
  • Quick open
  • Snippets
  • Sort
  • Spell Checker