Ubuntu – Gedit is not opening a file from terminal

command linegeditvps

I've a Ubuntu 12.04 VPS with no graphical environment installed. In that VPS, I'm trying to open a file from terminal using gedit with this command

gedit config/database.yml

But unfortunately it is showing following error

(process:3790): Gtk-WARNING **: Locale not supported by C library.
    Using the fallback 'C' locale.
Cannot open display: 
Run 'gedit --help' to see a full list of available command line options.

How can I solve this problem?

Best Answer

gedit is a graphical editor. All graphical applications need an environment variable called $DISPLAY.

If you have running graphical session start gedit like this:

user@host:~# DISPLAY=:0 gedit config/database.yml

In case you dont have access to a graphical session try

user@host:~# nano config/database.yml