View previous topic :: View next topic |
Author |
Message |
stephenry n00b
Joined: 27 May 2003 Posts: 25
|
Posted: Sat Aug 16, 2003 9:40 am Post subject: Trivial command line question |
|
|
Hi all,
I have a simple, but annoying, problem with my install. When I'm in X, I open a command line, and, from there, execute programs. The problem I'm having is that when i execute an application, say xmms, the window become unusable until I close xmms. The only way to overcome this is to open another command line window. Is it possible to open and run multiple applications from the one terminal?
Cheers,
Steve. |
|
Back to top |
|
|
barryboring n00b
Joined: 09 Jul 2003 Posts: 19
|
Posted: Sat Aug 16, 2003 9:44 am Post subject: |
|
|
Hey,
Code:
xmms &
will start xmms and then give you your prompt back.
bb |
|
Back to top |
|
|
guard0 Tux's lil' helper
Joined: 26 Jun 2003 Posts: 96
|
Posted: Sat Aug 16, 2003 9:46 am Post subject: |
|
|
or after the program starts, hit ctrl+z and then type "bg" and that will force it to the background |
|
Back to top |
|
|
compu-tom Guru
Joined: 09 Jan 2003 Posts: 415 Location: Berlin, Germany
|
Posted: Sat Aug 16, 2003 9:47 am Post subject: |
|
|
Append an ampersand to the command line:
This starts the command in the background.
Alternatively you can suspend the command with Ctrl-z while it is running in the foreground. Then send it to background with bg:
Get a list of background jobs with
Foreground a background job with
where 1 is the job number. See the output of "jobs" for job numbers. |
|
Back to top |
|
|
stephenry n00b
Joined: 27 May 2003 Posts: 25
|
Posted: Sat Aug 16, 2003 9:53 am Post subject: |
|
|
Thanks everyone for the reply, got it working fine now... |
|
Back to top |
|
|
pi314 Tux's lil' helper
Joined: 31 Jul 2003 Posts: 136 Location: Germany
|
Posted: Sat Aug 16, 2003 10:06 am Post subject: |
|
|
maybe you will also try using screen
this will give you some idea of it
it's grate if you want to reopen your running programms from another terminal, or if you sometimes close your terminal (or get disconnected)[/code] |
|
Back to top |
|
|
Sven Vermeulen Retired Dev
Joined: 29 Aug 2002 Posts: 1345 Location: Mechelen, Belgium
|
Posted: Sat Aug 16, 2003 10:13 am Post subject: |
|
|
The problem with "xmms &" is that, when you close the terminal in which you have started xmms, xmms will close too (as it is the child of that terminal).
To solve this, use "nohup":
|
|
Back to top |
|
|
pi314 Tux's lil' helper
Joined: 31 Jul 2003 Posts: 136 Location: Germany
|
Posted: Sat Aug 16, 2003 10:19 am Post subject: |
|
|
hey cool
thx |
|
Back to top |
|
|
Verteron Apprentice
Joined: 23 Jul 2003 Posts: 189
|
Posted: Sat Aug 16, 2003 10:33 am Post subject: |
|
|
You can also avoid the problem of the app quitting when you close the terminal by doing this:
|
|
Back to top |
|
|
pi314 Tux's lil' helper
Joined: 31 Jul 2003 Posts: 136 Location: Germany
|
Posted: Sat Aug 16, 2003 10:52 am Post subject: |
|
|
... but how do I reatach these apps?
when I call "jobs" there is nothing listed
and a simple "fg" or "fg 1" does nothing, too |
|
Back to top |
|
|
Sven Vermeulen Retired Dev
Joined: 29 Aug 2002 Posts: 1345 Location: Mechelen, Belgium
|
Posted: Sat Aug 16, 2003 2:38 pm Post subject: |
|
|
You can't reattach graphical applications like that. Non-graphical (socalled console apps, or cli apps) can be detached and reattached using screen.
To create a screen session:
Code: |
$ screen -S somename
|
Inside the screensession, you start whatever cli tool you want. To detach, press ctrl-a followed by a d.
If you want to reattach, just issue
Code: |
$ screen -x somename
|
Screen has hundreds of neat thing it can do, check out the manpage for more information. |
|
Back to top |
|
|
|