# Accessing programs through the terminal with ruby

**URL:** <https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004>\
**Category:** Ruby\
**Created:** [August 9, 2010, 10:39pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004 "2010-08-09T22:39:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 9, 2010, 10:39pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/1 "2010-08-09T22:39:19Z")

</div>

Specifically browsers. I’m trying to get a bunch of different browsers  
(FF, Opera, Safari, IE, Chrome, and Fock) to all open the same url/file  
location either 1) Simultaneously or 2) One after the other. Meaning one  
browser open and when you close it out the next one opens.

So basically I need to know if it’s possible to submit commands to the  
terminal to open browsers to a specific location.

I’m using the gnome-terminal in Ubuntu 10.04

Thanks in advance! 😃

---

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 9, 2010, 11:00pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/2 "2010-08-09T23:00:31Z")

</div>

In OS X : open /Applications/Tools/browsers/Firefox.app

In Ubuntu : Gnome : gnome-open Firefox

From irb: FIREFOX would be opened. Samething in Ubuntu

! irb  
irb(main):001:0\> `open /Applications/Tools/browsers/Firefox.app`  
=\> “”  
irb(main):002:0\>

---

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 9, 2010, 11:04pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/3 "2010-08-09T23:04:02Z")

</div>

You could try the launchy gem, its specifically for launching the  
default  
browser,  
but the documentation might hint at other uses.

---

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 9, 2010, 11:25pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/4 "2010-08-09T23:25:58Z")

</div>

Tried all of these. None of them really seemed to work. Came across this  
though, and it worked great.

#!/usr/bin/ruby  
nugen = “[http://www.nugendesign.com](http://www.nugendesign.com)”  
system “firefox #{nugen}”

---

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 10, 2010, 12:18am UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/5 "2010-08-10T00:18:50Z")

</div>

Ok so I started working on this a little bit and I basically have this  
so far:

#!/usr/bin/ruby  
puts “Enter url”  
url = gets

system “firefox #{url}”  
system “opera #{url}”  
system “flock #{url}”

So far it’s doing exactly what I want it to do, but when it gets to  
flock it does this:

flock: bad number: [http://www.nugendesign.com](http://www.nugendesign.com)

---

<div class="post-metadata">

**Author:** ![kaspir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/3ab097/32.png) [@kaspir](https://www.ruby-forum.com/u/kaspir)\
**Post date:** [August 9, 2010, 11:05pm UTC](https://www.ruby-forum.com/t/accessing-programs-through-the-terminal-with-ruby/193004/6 "2010-08-09T23:05:12Z")

</div>

On 8/9/2010 1:58 PM, Joseph E. Savard wrote:

> In Ubuntu : Gnome : gnome-open Firefox

gnome-open

should work too.
