Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
-e program [ arguments ... ]
This option specifies the program (and its command line argu-
ments) to be run in the xterm window. It also sets the window
title and icon name to be the basename of the program being
executed if neither -T nor -n are given on the command line.
This must be the last option on the command line.
I fond this email posting while searching solutions to the problem I have while tring to execute commands in new xterms from script. I my script I wrote:
xterm -e ls &
xterm -e date &
xterm -e pwd &
When I run the script, it opened up three terminals but they fade away, I'm not sure whether they has excuted commands. Any idea?
The problem is that the commands that you are running end. When the command ends, the window closes. If you want to run this type of command and keep the window open, you can force a bash prompt. For example:
xterm -e ls\;bash &
The ';' separates commands, so the above issues two commands: 'ls' and 'bash'. The ';' has a backslash in front of it, because we want to send the ';' to xterm, not use it to end the xterm command.
Thanks a lot, I've tried it and it worked with xterm. I have changed my script to use gnome-terminal instead of xterm, somehow bash command won't work with gnome-terminal, I wonder why?
Thanks a lot!
Gnome-terminal works differently from xterm. The easiest way to do this with gnome-terminal is, for example:
gnome-terminal -e "bash -c ls\;bash"
This says to run gnome-terminal and pass it the command "bash". The bash command will be passed the option "-c" which causes it ro run the commands "ls" followed by bash as in the earlier xterm example.