Linux Commands Examples

A great documentation place for Linux commands


text editor for the GNOME Desktop


gedit [OPTION...] [FILE...] [+LINE[:COLUMN]]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



How to tell GEDIT to reload currently opened file

This functionality is not yet present in Gedit, but it's on the Requested plugins list

function gedit {
apt-get install -y gedit

How to configure GEdit correctly?

You can have the lines in the left side by navigating to Edit -> Preferences and checking off Display Line Numbers. Additional plugins can be grabbed here and configured under Edit -> Preferences -> Plugins Tab.

You can grab Auto Indent here and Auto Complete here.

Here's a shot of preferences for reference:

alt text


Shortcut to remove first character of multiple lines in gedit

That really depends on the software you're using.

For instance, MS-Word would left you alt-select the first character of the lines (if the lines doesn't wrap around).

If you're using an editor that allows Regular Expression search and replace you could use something like ^. to search for the first character of each line.

Unfortunately you need to be more specific.

gedit todo_list
gedit cloud*.rb &
gedit output &

use gedit to open file with null characters

I believe that works on a document that's already loaded rather than one that's in the process of being loaded.

You could use a wrapper script or function that does the tr for you then launches gedit.


Can gedit on mac be used to edit files over ssh?

Use the -X option when you ssh into your linux machine. If you haven't already installed X11, it's available as an optional install on your OS X install disc. With X11 installed, 'ssh -X user@host' starts X11 and you're ready to use gedit.

Alternatively, you can use Macfusion to mount your linux machine, through ssh, as a file system. You can then use an OS X text editor to edit files on the remote machine.


Formatting gets changed when trying to copy text from gedit to vim

Take a look here. Basically it's the pastetoggle option.


Does Gedit have cool keyboard shortcuts?

VIGedit - might have to muck around with it a bit, but sounds like what you want.

also worth reading this "ViGedit–Gedit’s Simplicity with Vi(m)’s Power"


Changing GEdit's default file open/save path?

Similar things have been requested, although it seems they don't plan on changing it. It is hardcoded into gedit that the initial default save directory is the user's home folder. After you save to a different location, gedit will remember the new location and make that the default for the next save. With that said, just open gedit and save something to the desktop. The next time you go to save something it should point there already, although if you save somewhere else it will change. There is no way of changing the default to always be a specific location unless you edit the source.


How can I show "space" as "-" or other marks in gEdit?

It appears that the gEdit plugin "Draw Spaces" has this functionality.


Can't install gedit plugins on Linux Mint 12

The solution is found here. Apparently one needs to

  • Change the extension for the description file from .gedit-plugin to .plugin (which I did)
  • In addition one must edit the header of this file from [Gedit plugin] to [Plugin]

The second point solved the problem for me, but this should be better documented by the gedit guys.


unable to open a file in gedit from the terminal when I login as root

By default, and for security reasons, the only user that interacts with X-server is the logged-in user. Meaning, You can not initiate a connection to x-server as a different user or in your case as root, unless you have overridden the default setting to allow different users/hosts to connect to x-server. So the error message you are getting is related to x-server since any other user can't connect to it. In order to get around it, you have various fixes you can apply. What I normally do when ever I need to run an X-app as root is as follows.

  • From normal user terminal, I run xhost + to grant access to all user temporarily
  • Then I log in as root from a different terminal and execute the X-app ie gedit tester.php

To make it permanent (which I don't suggest), edit /etc/profile and add the following line:

export XAUTHORITY=/root/.Xauthority


Gedit opens on all workspaces?

I'm sure you know this, but fedora 10 is outdated and no longer supported and you should probably migrate to something fresher, and probably this issue doesn't even exist there :)

Question: Does this happen when you launch it from a terminal too, or only from the entries provided by xfce? What version of xfce? Is it a pure xfce & xfwm setup or do you use it in combination with something else? (Can't post comments, forgive me!)

The name for this behaviour is sticky, might want to check the settings manager (window manager and related sections) for how it's set up.

If unable to find the cause, you could hack around it with wmctrl, see here using wmctrl -r gedit -b remove,sticky


How to move files and folders with Gedit?

It is kinda... Well... Not proper. (as in not a plugin).

1) Click File -> Open

2) Locate directory

3) Drag and Drop file into any folder within that directory.


Ctrl + x (cut), Ctrl + c (copy), Ctrl + v (paste) or just use right click menu. Now move to the other directory and paste it.


gedit is the official text editor of the GNOME desktop environment.

While aiming at simplicity and ease of use, gedit is a powerful general purpose text editor. It can be used to create and edit all kinds of text files.

gedit features a flexible plugin system which can be used to dynamically add new advanced features to gedit itself.


-b, --background

Run gedit in the background.


Set the character encoding to be used for opening the files listed on the command line.

-g, --geometry=GEOMETRY

Set the X geometry window size (WIDTHxHEIGHT+X+Y).


Display list of possible values for the encoding option and exit.


Create a new toplevel window in an existing instance of gedit.


Create a new document in an existing instance of gedit.

-s, --standalone

Run gedit in standalone mode.

-w, --wait

Open files and block the gedit process.


Prints the command line options.


Output version information and exit.


Specifies the file to open when gedit starts. If this is not specified, gedit will load a blank file with an "Unsaved Document" label. Multiple files can be loaded if they are separated by spaces. gedit also supports handling of remote files. For example, you can pass the location of a webpage to gedit , like "", or load a file from a FTP server, like "".


For the first file, go to the line specified by LINE (do not insert a space between the "+" sign and the number). If LINE is missing, go to the last line.


For the first file, go to the column specified by COLUMN. If COLUMN is missing, go to the first column.


If you find a bug, please report it at


Paolo Maggi (paolo[:at:]gnome[:dot:]org)
Paolo Borelli (pborelli[:at:]katamail[:dot:]com)
Steve Frécinaux (code[:at:]istique[:dot:]net)
Jesse van den Kieboom (jessevdk[:at:]gnome[:dot:]org)
Ignacio Casal Quinteiro <icq[:at:]gnome[:dot:]org>
James Willcox (jwillcox[:at:]gnome[:dot:]org)
Federico Mena Quintero (federico[:at:]novell[:dot:]com)
Chema Celorio

How can this site be more helpful to YOU ?

give  feedback