LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-12-2012, 10:47 AM   #1
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Rep: Reputation: 46
How to run Firefox through CLI


Hi everybody. I'm trying to setup some storage with a server, and I have to run a web browser to go to a specific IP from the CLI of my server.

I've never had to run a browser in Linux before, but through google I found that I should run
/usr/bin/firefox -new-window http://1.2.3.4

but I get
Error: no display specified

Right now I'm SSH'd to the server through Putty. Can someone tell me how to specify a display to make that webpage load from that server?
 
Old 12-12-2012, 10:49 AM   #2
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
Or, is there some built-in browser to RHEL that I could run instead of Firefox? I don't believe i have any GUI's installed on this server, but not really sure how to confirm.
 
Old 12-12-2012, 11:54 AM   #3
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,164
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
Code:
lynx http://1.2.3.4 or 
links http://1.2.3.4
should work.
 
Old 12-12-2012, 12:11 PM   #4
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 979
Blog Entries: 2

Rep: Reputation: 235Reputation: 235Reputation: 235
Assuming you're on Windows (hence PuTTY) get Xming (an Xserver) installed and running and enable X-forwarding in your PuTTY connection. Then when you run firefox it should run on the remote host but travel through the SSH to use your screen/keyboard/mouse.
 
Old 12-12-2012, 12:19 PM   #5
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
Thanks guys. I'll try both them out later when I get back on that server.
 
Old 12-12-2012, 02:14 PM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Error: no display specified
This could be an issue with DISPLAY variable, so in any case if above suggested solutions do not help, then check and set the DISPLAY variable first. To check:
Code:
echo $DISPLAY
 
Old 12-13-2012, 01:09 AM   #7
ayush.jain
LQ Newbie
 
Registered: Oct 2012
Location: India
Distribution: SUSE
Posts: 9

Rep: Reputation: Disabled
By default, Putty should have configured $DISPLAY for you.

Make sure X11 forwarding is enabled in putty (Connection....SSH....X11), also X11 forwarding is enabled on the server for sshd (sshd_config --> "X11Forwarding yes"), and X server running on Windows to throw display.

Alternatively, what I prefer is starting a vnc server on remote machine, and accessing using vnc client. That saves lost connection problems as well as time.

Regards,
_Ayush
 
Old 12-13-2012, 10:40 AM   #8
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by ayush.jain View Post
By default, Putty should have configured $DISPLAY for you.

Make sure X11 forwarding is enabled in putty (Connection....SSH....X11), also X11 forwarding is enabled on the server for sshd (sshd_config --> "X11Forwarding yes"), and X server running on Windows to throw display.
Putty doesn't set any variables on the server; the ssh server does. And not by default, only if the client (putty) has specified to use an X tunnel. If the value of $DISPLAY gets set to 'localhost:n', where 'n' is some low valued integer, then the tunnel has been successfully set up. The tunnel will only be helpful if there is an X server running on the Windows host. Xming or cygwin-X are free and adequate for most things.

--- rod.
 
1 members found this post helpful.
Old 12-13-2012, 04:57 PM   #9
rjo98
Senior Member
 
Registered: Jun 2009
Location: US
Distribution: RHEL, CentOS
Posts: 1,668

Original Poster
Rep: Reputation: 46
Looks like I only have links on here.

Also, echo $DISPLAY returns nothing, just as an FYI.
 
Old 12-13-2012, 09:08 PM   #10
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
$DISPLAY tells all X client applications where to find an X server. If that variable is not set, the application will not run (Error: no display specified). If it is set, it must be of the form 'hostname:n', where 'n' is the server number on that host, typically 0. In a tunneled X scenario, the hostname will be 'localhost', and the server number will be some low integer value. If you are logging in from Windows, you will have to have an X server running on the Windows host. The X client applications will use that X server to display the GUI of the X application on your Windows host (even though the application is running on the Linux host that you're logged into with SSH (Putty).
As someone has already mentioned, text-mode web browsers may be an option. As non-X applications, they don't need an X server, or care about $DISPLAY.

---- rod.
 
1 members found this post helpful.
Old 12-13-2012, 11:29 PM   #11
ayush.jain
LQ Newbie
 
Registered: Oct 2012
Location: India
Distribution: SUSE
Posts: 9

Rep: Reputation: Disabled
Hi Rod..

Actually I meant the same when I said Putty would have set $DISPLAY for you, I meant ssh through putty causing ssh server to set it. (provided X tunnel is set in putty)
But thanks for clarifying the same as the way I have written is sounding quite wrong (technically).

You made it clear like a crystal.

Regards,
_Ayush
 
  


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
how do I specify the desktop manager to run from CLI? newbiesforever Linux - General 2 08-17-2012 06:15 AM
[SOLVED] Force Truecrypt to run in CLI only czezz Slackware 5 04-27-2012 06:32 AM
How to run emacs in CLI inside of GUI? Mr. Alex Linux - Newbie 1 07-29-2011 07:55 AM
CLI firefox them install PatrickNew Linux - Software 1 03-13-2007 10:08 PM
How can i run in just the CLI? nairnie Linux - Newbie 6 11-22-2003 02:07 AM


All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration