Why gedit is not opening a file from terminal?

12,040

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

Share:
12,040

Related videos on Youtube

Max Ricketts
Author by

Max Ricketts

Updated on September 18, 2022

Comments

  • Max Ricketts
    Max Ricketts over 1 year

    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?

    • Avinash Raj
      Avinash Raj over 10 years
      what is config is that a directory?
    • falconer
      falconer over 10 years
      If there is no graphical environment installed, then how would you like to start a graphical program? If on the other hand you are connecting to the server with ssh, then you can use X11 forwarding, and that way you can use gedit.