Select Page


Gedit is a text editing program which is specifically made to be used in the GNOME Desktop Environment. You might be questioning the need to design text editors for specific environments. To be very honest, it actually looks good given that the editor matches the overall UI of your desktop. However, don’t expect it to have any of the advanced features other text editors usually have. Despite it all, if you don’t bother about the features and worry more about getting your job done, gedit is actually quite a useful text editor. 

Gedit has a GUI unlike terminal text editors such as Vim and Emacs, but it can be started from the terminal which opens up the GUI window – if you prefer that (there are several advantages to starting gedit from a terminal, like you can pass in other arguments at startup). However, many users have reported that they are getting the following error message when they try to run the gedit command:

$ gedit: command not found

If you’re facing the same situation too, this article should be enough to help you fix the error message without any further errors popping up your way in the process!

Why is the gedit command not found?

There are mainly two reasons for not being able to run the gedit command from the terminal in your Linux system.  The first possibility is that you don’t have the program installed at all. You might have used it before, and are sure that it existed in your system too. But it is not impossible to get the program removed without your notice. If this is really the case, you’ll need to install the program before you can use the gedit command again from the terminal. 

The second possible case is getting your path variable messed up. If the directory where the executable file for gedit is not sourced by the system, then you’d not be able to run the command unless you enter the directory and manually run it from there. Which is why you’ll first need to append this directory to your system’s PATH variable. 

In the following sections, we’ll go through the fixes for this issue in detail.

Install gedit command in Linux

In order to install the gedit command in Linux, you need to use a package manager, which is specific to the distribution you’re using. Some distributions use the same package manager, while many others tend to follow their own path by using a package manager dedicated to the OS. If you don’t know already, Linux currently has more than 600 active distributions that you use. Luckily, most of these are forks of the popular ones available out there like Ubuntu and Arch Linux. 

For now, here are the commands you’d use in the most popular Linux distributions in order to install the gedit command:

Arch Linux

$ sudo pacman -Syu
$ sudo pacman -S gedit


$ sudo apt-get update
$ sudo apt-get install gedit


$ sudo apt-get update
$ sudo apt-get install gedit


$ sudo yum makecache
$ sudo yum install gedit


$ sudo dnf makecache
$ sudo dnf install gedit


$ sudo dnf makecache
$ sudo dnf install gedit

Kali Linux

$ sudo apt-get update
$ sudo apt-get install gedit

Alpine Linux

$ sudo apk update
$sudo apk add gedit

Be very careful about not forgetting to use the first line of command. It is required to update and refresh your system’s repositories so that you don’t get another error like “Unable to locate package gedit”, or something similar. The second line of command installs the actual gedit package.

As soon as the download is over, you should directly be able to execute the program from your terminal:

$ gedit

If you see that the error message persists, then all you’re left to do is fix your PATH variable now.

Fix your path variable

Usually, most programs are installed under the usr/bin directory, and if this directory is not listed under the PATH variable, then you’d not be able to run any commands which are inside this directory. Before you can fix this, you need to know which shell your system is using. If you’re using the Bourne Again Shell, then you should have a file called .bashrc under your home directory (hidden). Open this file using any other text editor like nano, which should already be installed:

$ nano ~/.bashrc

Inside this file, append the following line of code:

export PATH=$PATH:/usr/bin

Save and exit the file, by pressing <Ctrl + O>, <Enter>, <Ctrl + X> in order. Afterwards, restart your terminal for changes to take effect. Now try running the gedit command again. If you’ve successfully been able to run it, congratulations! 

But if you couldn’t find luck to do so, it’s about time you look out for some alternatives (trust me, you won’t regret it)

Alternatives to gedit

If you’re fine using a terminal text editor, I’d suggest you give Vim a try. It takes a little bit of time to get used to, but it is worth it! However, there’s also one called Micro, which has very good mouse support, and keyboard shortcuts similar to that of a GUI Text editor (like Ctrl + s to save and Ctrl + q to quit). If only GUI editors are your thing and would like to use a lightweight text editor (as compared to VS Code and Sublime Text), there are a couple of good alternatives to gedit which you can try out:

  • Mousepad
  • Leafpad
  • Bluefish Text Editor
  • Geany