LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices

Reply
 
Search this Thread
Old 03-02-2014, 01:03 PM   #1
Otto-1062
LQ Newbie
 
Registered: Jul 2006
Posts: 29

Rep: Reputation: 0
How to start program from command line


I like to use the gedit program.

pi@raspberrypi ~ $ ls
Desktop Documents Dropbox indiecity ocr_pi.png python_games
pi@raspberrypi ~ $ cd Documents
pi@raspberrypi ~/Documents $ ls
test test~
pi@raspberrypi ~/Documents $ sudo gedit test
Invalid MIT-MAGIC-COOKIE-1 keyCannot open display:
Run 'gedit --help' to see a full list of available command line options.
pi@raspberrypi ~/Documents $

What am I missing.

tia
otto-1062
 
Old 03-02-2014, 01:20 PM   #2
astrogeek
Senior Member
 
Registered: Oct 2008
Distribution: Slackware: 12.1, 13.1, 14.1, 64-14.1, -current, FreeBSD-10
Posts: 1,865

Rep: Reputation: 639Reputation: 639Reputation: 639Reputation: 639Reputation: 639Reputation: 639
Why sudo?
 
Old 03-02-2014, 02:00 PM   #3
Otto-1062
LQ Newbie
 
Registered: Jul 2006
Posts: 29

Original Poster
Rep: Reputation: 0
Thanks, I had always used sudo while in Ubuntu. Never gave it a thought.
 
Old 03-02-2014, 02:49 PM   #4
Otto-1062
LQ Newbie
 
Registered: Jul 2006
Posts: 29

Original Poster
Rep: Reputation: 0
Got ahead of myself.
Using
$ cd /.motion
$ gedit motion.conf
The edit box came up but said to effect did not have permission to edit
therefore went to sudo. See below
pi@raspberrypi ~ $ cd /.motion
pi@raspberrypi /.motion $ gedit motion.conf
pi@raspberrypi /.motion $ sudo gedit motion.conf
Invalid MIT-MAGIC-COOKIE-1 keyCannot open display:
Run 'gedit --help' to see a full list of available command line options.
pi@raspberrypi /.motion $ sudo nano motion.conf
nano work correctly.
 
Old 03-02-2014, 03:00 PM   #5
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 7,030
Blog Entries: 52

Rep: Reputation: Disabled
Try:
Code:
gksudo gedit motion.conf
 
Old 03-02-2014, 03:17 PM   #6
Emerson
Senior Member
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~
Posts: 3,177

Rep: Reputation: Disabled
Are you logged in over SSH?
 
Old 03-03-2014, 10:28 AM   #7
Otto-1062
LQ Newbie
 
Registered: Jul 2006
Posts: 29

Original Poster
Rep: Reputation: 0
pi@raspberrypi / $ cd /.motion
pi@raspberrypi /.motion $ gksudo gedit motion.conf

(gksudo:2213): Gtk-WARNING **: cannot open display:
pi@raspberrypi /.motion $

---------- Post added 03-03-14 at 11:29 AM ----------

Results same using SSH or signed in directly.
 
Old 03-07-2014, 02:58 AM   #8
trbennett48
LQ Newbie
 
Registered: Apr 2011
Posts: 23

Rep: Reputation: 3
Although I've never used gedit, its man page indicates it is
an X-window enabled file editor. You seem to be invoking
gedit from the command line and it is complaining about not being
able to open "display:".

The $DISPLAY environmental variable is used to tell gedit how
to connect to the X-window... I'm guessing it is not set...
...probably because you "ssh'ed" to your rpi.
(You can confirm it is not set by issuing
Code:
echo $DISPLAY
)

nano works because it is NOT an X-window enabled application.
 
Old 03-07-2014, 10:19 AM   #9
Otto-1062
LQ Newbie
 
Registered: Jul 2006
Posts: 29

Original Poster
Rep: Reputation: 0
pi@raspberrypi ~ $ echo $DISPLAY
:0

pi@raspberrypi ~ $ cd Documents
pi@raspberrypi ~/Documents $ ls
test test~
pi@raspberrypi ~/Documents $ gedit test

pi@raspberrypi ~/Documents $

Above from regular desktop. The gedit of test worked correctly.
File was edited and saved.
It appears something is lost when SSH'ing.
Thanks all for clearing all this up for me.
otto
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xinetd does not seem to recognize the line to start a program lilmike Linux - Server 1 12-05-2009 01:10 AM
How to use c++ to use a command line program jboss1995 Programming 4 04-05-2008 10:22 PM
Start 'Add/Remove' program GUI from command line j_70 Linux - Software 1 02-08-2008 02:59 PM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM
How can I start X from the command line JTWebster Linux - Newbie 3 08-24-2002 10:38 PM


All times are GMT -5. The time now is 11:18 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration