Linux gedit
Commands
Overview
gedit
is a simple text editor for the GNOME desktop environment. It is known for its ease of use and is suitable for editing text files, programming scripts, and more. This document covers basic gedit
commands and operations.
Opening Files
Open a File
To open a file with gedit
, use the following command:
Example
Editing Files
Create a New File
To create a new file, simply open gedit
without specifying a file name:
Example
Save Changes
To save changes to a file, use the graphical interface:
- Click
File
>Save
or pressCtrl + S
. - Choose the file name and location, then click
Save
.
Example
- Make edits to the document.
- Press
Ctrl + S
to save.
Save As
To save the file with a new name or location:
- Click
File
>Save As...
or pressCtrl + Shift + S
. - Enter the new file name and location, then click
Save
.
Example
- Click
File
>Save As...
. - Enter a new name like
newfile.txt
and select the location. - Click
Save
.
Undo and Redo
To undo or redo changes:
- Undo:
Ctrl + Z
- Redo:
Ctrl + Y
Example
Searching and Replacing
Search for Text
To search for text within the file:
- Press
Ctrl + F
. - Enter the search term and press
Enter
.
Example
- Press
Ctrl + F
. - Type
search_term
and pressEnter
.
Replace Text
To replace text within the file:
- Press
Ctrl + H
. - Enter the search term and the replacement term.
- Click
Replace
orReplace All
.
Example
- Press
Ctrl + H
. - Enter
old_term
in the search box andnew_term
in the replace box. - Click
Replace
orReplace All
.
Other Useful Commands
Open Multiple Files
To open multiple files at once, list them after the gedit
command:
Example
Open Files from a Directory
To open all text files in a directory:
Example
Open Files with Specific Encoding
To open a file with a specific encoding, use the --encoding
option:
Example
Summary
gedit
is a versatile text editor with a straightforward graphical interface. It allows for simple text editing tasks such as creating, opening, saving, and searching files. For more detailed information and options, refer to the gedit
documentation or the GNOME Help.