How to execute a command in newly open terminal(gnome-terminal) in scripting ?

Donald Talbert donaldtalbert at
Fri Jul 1 08:40:33 UTC 2011

On Thu, 2011-06-30 at 07:02 -0400, amritpal pathak wrote:
> On Thu, Jun 30, 2011 at 6:54 AM, Jordon Bedwell <jordon at>
> wrote:
>         On 6/30/2011 5:46 AM, Carl Friis-Hansen wrote:
>         > You might need to do it on the same line, like:
>         > gnome-terminal -e "ls -l"
>          it couldn't help.It is executing the command in same terminal
>         even it is not opening new one despite "gnome-termial" was
>         opening a new terminal at least.
>   Thanks  

I might be mistaken on what your trying to accomplish but heres a way to
do this. You will need to 'screen' package so type, then read the man
page on it, very easy to use.

sudo apt-get install screen 

Heres how you do this. (A snip of code from our scripts)

screen -AdmS server /srv/serv/

you would type...

screen -AdmS windowname directorytoscript-or-whatyouwanttorun

screen is a very very useful program, be sure to read the man page. Its
not hard to learn and will help you with bash shells.


Donald Talbert <donaldtalbert at>

More information about the ubuntu-users mailing list