The gedit text editor is the default text editor used in GNOME desktop environments and is a member of the GNU Project. Unlike Vim and nano, gedit has a GUI with a typical menu-based design that makes it easy to work with. It also has features like syntax highlighting and spell checking and can be customized through plugins. While not as powerful as Vim, gedit may still be useful in systems with a desktop environment.
Although you can launch gedit from the desktop, you can also use the CLI with the gedit command. The syntax is similar to vim and nano—no argument opens a new file, whereas providing a file name as an argument either opens an existing file or creates a new one with that name.
If you encounter the below error while running the gedit command:
gedit: command not found
you may try installing the gedit package as per the choice of your distribution:
|OS X||brew install gedit|
|Debian||apt-get install gedit|
|Ubuntu||apt-get install gedit|
|Arch Linux||pacman -S gedit|
|Kali Linux||apt-get install gedit|
|CentOS||yum install gedit|
|Fedora||dnf install gedit|
|Raspbian||apt-get install gedit|
gedit Command Examples
1. Open a text file:
# gedit path/to/file
2. Open multiple text files:
# gedit file1 file2 ...
3. Open a text file with a specific encoding:
# gedit --encoding=UTF-8 path/to/file
4. Display a list of supported encodings:
# gedit --list-encodings