LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-24-2004, 09:37 AM   #1
checkchan
LQ Newbie
 
Registered: Jul 2003
Posts: 17

Rep: Reputation: 0
run command in new gnome-terminal


I am running redhat 8. When I run this command: "gnome-terminal -e ls" the ls command is executed in the new window but then terminates the window. The same is true when I tried xterm.
In the terminal profile if I select "execute command and restart" the ls command is executed several times and the new window then seemed to be hung.
 
Old 01-07-2005, 04:50 PM   #2
marin_linuxer
LQ Newbie
 
Registered: Aug 2003
Location: San Rafael, CA U.S.A.
Distribution: Arch Linux (archlinux.org)
Posts: 8

Rep: Reputation: 1
Hi, if you still haven't figured this out, then .... here it is for myself and others in the future:

Code:
gnome-terminal -x sh -c "ls|less"

I was trying to figure-out how to do this:

Code:
gnome-terminal -x sh -c "cal -y|less"
and in an 'xterm':

Code:
xterm -e "cal -y|less"

To 'sleep' the command:

Code:
xterm -e "cal -y; sleep 10"
or

Code:
gnome-terminal -x sh -c "cal -3; sleep 10"

Hope this helps!

Last edited by marin_linuxer; 01-07-2005 at 04:55 PM.
 
1 members found this post helpful.
Old 01-08-2005, 10:14 AM   #3
checkchan
LQ Newbie
 
Registered: Jul 2003
Posts: 17

Original Poster
Rep: Reputation: 0
Yes gnome-terminal works but xterm still will not stay on after running the comand. I remembered I got a response from somewhere that this is a bug in gnome. Maybe it works in kde?
 
Old 01-08-2005, 12:59 PM   #4
marin_linuxer
LQ Newbie
 
Registered: Aug 2003
Location: San Rafael, CA U.S.A.
Distribution: Arch Linux (archlinux.org)
Posts: 8

Rep: Reputation: 1
AHhhhhhh ... yes, I misunderstood you. Sorry.
 
Old 09-18-2010, 06:26 AM   #5
sorenchr
LQ Newbie
 
Registered: Jun 2006
Posts: 21

Rep: Reputation: 0
Quote:
Originally Posted by marin_linuxer View Post
AHhhhhhh ... yes, I misunderstood you. Sorry.
I was struggeling with this too. Needed the term to stay open after ssh'ing into another machine. Could not get the term to accept interactive commands so in stead made use of .bashrc to execute custom commands:
if [ "$customcmd" ]; then
$customcmd
fi

export customcmd="echo test" before calling gnome-terminal and then use unset to return to status quo.

Soren
 
Old 11-28-2011, 05:26 AM   #6
ok.sujeet
LQ Newbie
 
Registered: Nov 2011
Location: Bangalore
Distribution: Cent OS
Posts: 1

Rep: Reputation: Disabled
Smile gnome-terminal

It works and thanks a lot .
 
Old 11-30-2011, 09:28 AM   #7
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
Open a default terminal. Right click in it. Mouse over "Profiles" and then "Profile Preferences". Click that. The second tab at the top -- "Title and Command", click that. At the bottom click the box that has the dialog "When command exits" on the left of it and choose "Hold the terminal open". Then close.
 
Old 01-04-2012, 11:51 AM   #8
shantanu18
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
Talking

save your command in a bash file. Then run the bash file. So you don't need to edit gnome-terminal profile.

Code:
#!/bin/bash
#file name: run.sh

gnome-terminal -x sh -c "ls -l | less"
Set executable bit and run.
Code:
chmod +x run.sh  [do not run each time]
./run.sh
 
1 members found this post helpful.
Old 03-08-2012, 01:27 PM   #9
13thfloor
LQ Newbie
 
Registered: Sep 2010
Posts: 1

Rep: Reputation: 0
I've set up a bash script as suggested in the previous post but I have several servers that I want to group together. Any idea how to open multiple tabs instead of several new terminal windows?

Code:
#!/bin/bash

gnome-terminal -x sh -c "ssh server1"
gnome-terminal -x sh -c "ssh server2"
gnome-terminal -x sh -c "ssh server3"

Last edited by 13thfloor; 03-08-2012 at 01:30 PM. Reason: provide more info
 
Old 03-09-2012, 07:05 PM   #10
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
Quote:
Originally Posted by 13thfloor View Post
I've set up a bash script as suggested in the previous post but I have several servers that I want to group together. Any idea how to open multiple tabs instead of several new terminal windows?

Code:
#!/bin/bash

gnome-terminal -x sh -c "ssh server1"
gnome-terminal -x sh -c "ssh server2"
gnome-terminal -x sh -c "ssh server3"
Well, you can right click in the gnome-terminal window and click "Open Tab" a couple times and ssh into each server in each tab. Change between tabs with "alt-1", "alt-2" and "alt-3" if you have three tabs open. This does not work with KDE unless you go through hoops to change the key bindings but it works in Gnome.
 
Old 08-29-2012, 03:55 AM   #11
molinisho
LQ Newbie
 
Registered: Aug 2012
Posts: 1

Rep: Reputation: Disabled
To open several tabs in one window I do this:

Code:
#!/bin/bash

gnome-terminal --tab --title="TITLE1" -e "ssh server1" --tab --title="TITLE2" -e "ssh server2"
The option --title is optional, but it's so helpful.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a terminal command that I can run that will........... ludwig W Linux - Networking 20 11-28-2005 03:59 PM
gnome-terminal and nautilus cant run wrytin Linux - Software 0 04-21-2005 04:53 AM
Run user command on Terminal startup coolfrog Linux - General 4 09-26-2004 09:08 AM
how do i run GNOME from the terminal? help! kissmeimgerman Linux - Software 1 04-03-2004 01:35 AM
start terminal & run command automatically peeples Linux - General 2 09-08-2003 02:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:00 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
Open Source Consulting | Domain Registration