LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-23-2011, 12:10 PM   #1
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Rep: Reputation: 15
How that screen works?


Want create script that run in background 5 programs from 5 given dirs and all of them should be in one controlling screen. In other words how via script after created screen and attaching to it via screen -r via script vreate new window within that screen, run given program and detach for new itaration
 
Old 03-23-2011, 12:19 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Quote:
Originally Posted by icegood View Post
Want create script that run in background 5 programs from 5 given dirs and all of them should be in one controlling screen. In other words how via script after created screen and attaching to it via screen -r via script vreate new window within that screen, run given program and detach for new itaration
If I understand you correctly, you can do this to create a screen for a command, that will terminate when the command is complete.

Code:
screen -d -m -S ScreenName1 yes
Yes is a command, you can replace it with any command you would like.
 
Old 03-23-2011, 12:27 PM   #3
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by szboardstretcher View Post
If I understand you correctly, you can do this to create a screen for a command, that will terminate when the command is complete.

Yes is a command, you can replace it with any command you would like.
No, you understand me wrongly. By "run given program" i rather mean "start program and leave it running" and proceed after that new iteration. After whole 5 iterations i must have 5 windows within 1 screen with 5 runned programs
 
Old 03-23-2011, 12:29 PM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
What do you mean, "have 5 windows"? Are you talking about doing this in the gui?
 
Old 03-23-2011, 12:32 PM   #5
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by szboardstretcher View Post
What do you mean, "have 5 windows"? Are you talking about doing this in the gui?
I talk about those windows that i can selec within one screen session:
Quote:
" windowlist -b
- select -
0 select 0
1 select 1
2 select 2
3 select 3
4 select 4
5 select 5
6 select 6
7 select 7
8 select 8
9 select 9
 
Old 03-23-2011, 12:51 PM   #6
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
Ok.. in that case. You can start a main screen by:

Code:
screen
Once in that screen[0] type:

Code:
screen
Once in that screen[1] type:

Code:
Crtl-A A
Now you are back in the original screen[0], type:

Code:
screen
Now you are in screen[2], type:

Code:
Ctrl-A A
Now you are back in the original screen[0], type:

Code:
screen
and so on. From screen[0] you can do a

Ctrl-a :
windowlist

to select.

Also, you should add this to your .screenrc file to make it easier to understand where you are:

Code:
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"

Last edited by szboardstretcher; 03-23-2011 at 12:53 PM.
 
Old 03-23-2011, 12:56 PM   #7
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by szboardstretcher View Post
Ok.. in that case. You can start a main screen by:

Code:
screen
Once in that screen[0] type:

Code:
screen
Once in that screen[1] type:

Code:
Crtl-A A
Now you are back in the original screen[0], type:

Code:
screen
Now you are in screen[2], type:

Code:
Ctrl-A A
Now you are back in the original screen[0], type:

Code:
screen
And again. Main point to do all that stuff via script, not typing C-A and other nonprintable ones... Is it possible at all? Besides you rather use nested screens. It's possible to do without nesting.

Last edited by icegood; 03-23-2011 at 01:01 PM.
 
Old 03-23-2011, 05:45 PM   #8
icegood
Member
 
Registered: Sep 2009
Distribution: ubuntu 21.04
Posts: 65

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by icegood View Post
And again. Main point to do all that stuff via script, not typing C-A and other nonprintable ones... Is it possible at all? Besides you rather use nested screens. It's possible to do without nesting.
In this case i mean just simpler combination C-A + c. Maybe, it's same. Anyway. I did it rather manually but question with script still in power. About to think that it's impossible...

Quote:
Originally Posted by szboardstretcher View Post
Also, you should add this to your .screenrc file to make it easier to understand where you are:

Code:
caption always "%{= kw}%-w%{= BW}%n %t%{-}%+w %-= @%H - %LD %d %LM - %c"
Yeah, very important thing!
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
kdm works but startx doesn't (black screen stop) spikeygg Linux - Software 5 01-10-2010 04:38 PM
11.0 - Screen lock no longer works Shadoglare SUSE / openSUSE 7 08-28-2008 01:18 AM
Laptop video works on 10.2 but white screen on 12 enine Slackware 2 04-01-2008 08:29 AM
dual screen problems with certain monitors, works for others hedpe Linux - Desktop 4 03-28-2007 09:10 PM
Screen Dimming works in APM, but not in ACPI ming0 Linux - Laptop and Netbook 2 11-09-2004 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:14 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