Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Trivial command line question
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
stephenry
n00b
n00b


Joined: 27 May 2003
Posts: 25

PostPosted: Sat Aug 16, 2003 9:40 am    Post subject: Trivial command line question Reply with quote

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
View user's profile Send private message
barryboring
n00b
n00b


Joined: 09 Jul 2003
Posts: 19

PostPosted: Sat Aug 16, 2003 9:44 am    Post subject: Reply with quote

Hey,

Code:
xmms &

will start xmms and then give you your prompt back.

bb
Back to top
View user's profile Send private message
guard0
Tux's lil' helper
Tux's lil' helper


Joined: 26 Jun 2003
Posts: 96

PostPosted: Sat Aug 16, 2003 9:46 am    Post subject: Reply with quote

or after the program starts, hit ctrl+z and then type "bg" and that will force it to the background
Back to top
View user's profile Send private message
compu-tom
Guru
Guru


Joined: 09 Jan 2003
Posts: 415
Location: Berlin, Germany

PostPosted: Sat Aug 16, 2003 9:47 am    Post subject: Reply with quote

Append an ampersand to the command line:
Code:
xmms &

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:
Code:
xmms
[Ctrl-z]
bg


Get a list of background jobs with
Code:
jobs


Foreground a background job with
Code:
fg %1

where 1 is the job number. See the output of "jobs" for job numbers.
Back to top
View user's profile Send private message
stephenry
n00b
n00b


Joined: 27 May 2003
Posts: 25

PostPosted: Sat Aug 16, 2003 9:53 am    Post subject: Reply with quote

Thanks everyone for the reply, got it working fine now... :D
Back to top
View user's profile Send private message
pi314
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2003
Posts: 136
Location: Germany

PostPosted: Sat Aug 16, 2003 10:06 am    Post subject: Reply with quote

maybe you will also try using screen

this will give you some idea of it :D
Code:
man screen


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
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sat Aug 16, 2003 10:13 am    Post subject: Reply with quote

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":
Code:

# nohup xmms &
Back to top
View user's profile Send private message
pi314
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2003
Posts: 136
Location: Germany

PostPosted: Sat Aug 16, 2003 10:19 am    Post subject: Reply with quote

hey cool 8)

thx
Back to top
View user's profile Send private message
Verteron
Apprentice
Apprentice


Joined: 23 Jul 2003
Posts: 189

PostPosted: Sat Aug 16, 2003 10:33 am    Post subject: Reply with quote

You can also avoid the problem of the app quitting when you close the terminal by doing this:

Code:

(xmms &)
Back to top
View user's profile Send private message
pi314
Tux's lil' helper
Tux's lil' helper


Joined: 31 Jul 2003
Posts: 136
Location: Germany

PostPosted: Sat Aug 16, 2003 10:52 am    Post subject: Reply with quote

... 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
View user's profile Send private message
Sven Vermeulen
Retired Dev
Retired Dev


Joined: 29 Aug 2002
Posts: 1345
Location: Mechelen, Belgium

PostPosted: Sat Aug 16, 2003 2:38 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum