LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 08-27-2012, 08:43 PM   #1
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Fedora, CentOS, Scientific Linux, Ubuntu, Mint, Zorin, Puppy, Kali
Posts: 286

Rep: Reputation: 10
Question How to pass commands to 'screen'


Howdy.

I wonder how do I create 4 'screens' at bootup and start the things I want in each "screen".
I think I can start one with a script but how do a create more 'screens' and in those start
more stuff that I want?
Don't know how to "pass" the 'CRTL-N'to create a new screen.

I've been googling for weeks now and still haven't got things that work, but I've heard that
it is possible... or?


//B52
 
Old 08-27-2012, 09:38 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

I'm not sure if this is possible with screen (at least I never worked out how to do it).

I highly recommend that you look into tmux which can be considered a modern replacement of screen. I switched from screen to tmux about two years ago.

In particular you would probably find the ability to control it via a script to be just what you need. There is a nice example at:

http://blog.hawkhost.com/2010/07/02/...hell-scripting

For a more general introduction, for a screen user, try putting "screen vs tmux" into your favourite search engine.

HTH,

Evo2.
 
Old 08-27-2012, 11:12 PM   #3
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Fedora, CentOS, Scientific Linux, Ubuntu, Mint, Zorin, Puppy, Kali
Posts: 286

Original Poster
Rep: Reputation: 10
I'll have a look at that, but it seems it ain't that stable though
 
Old 08-27-2012, 11:21 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
Hi,

what stability issues are you referring to?

I've found it to be *very* stable. I don't recall ever having problems with it.

Evo2.
 
Old 08-28-2012, 12:54 AM   #5
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Fedora, CentOS, Scientific Linux, Ubuntu, Mint, Zorin, Puppy, Kali
Posts: 286

Original Poster
Rep: Reputation: 10
still gonna look into it
tnxs y'all
 
Old 08-28-2012, 03:26 AM   #6
Roken
Member
 
Registered: Oct 2011
Location: Bolton, UK
Distribution: Arch local, Debian on VPS
Posts: 258

Rep: Reputation: 41
You can interract with a screen sessions by using:

Code:
screen -r SCREENNAME -X log on
which will enable logging. All screen commands are supported. To issue a command to a process running in screen using STDIN:

Code:
screen -r SCREENNAME -X stuff "command ^M"
where the ^M character is typed as Ctrl V Ctrl M, and sends a carriage return.
 
Old 08-28-2012, 07:26 AM   #7
mjolnir
Member
 
Registered: Apr 2003
Posts: 750

Rep: Reputation: 83
I just tried this and it seems to work well. Paraphrased from here: http://ubuntuforums.org/showpost.php...19&postcount=3

"Re: GNU screen in startup screen: multiple commands
I think the OP wanted to run a single screen program with multiple internal "screens", each running a different program.

Here's one way to do it. screen(1) has a "-c" option to provide a startup file instead of $HOME/.screenrc. And that startup file can start new internal screens.

Example input file:"
Code:
# Screen startup file to start multiple commands under multiple screens.
# Start with "screen -c thisfilename"

# Screen 0: Start 'top'
# Screen 1: Start 'tail -F /var/log/syslog'

screen -t top    0 top
screen -t syslog 1 tail -F /var/log/syslog
"Save the above to a file, say "fancy.screenrc". Then start screen with:
Code:"
Code:
screen -c fancy.screenrc
I added elinks in my own iteration and it works like a charm on 12.04. I am still trying to learn a little command line and I've been switching between screen, tmux, and byobu. Byobu seems to be a little more user friendly.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] python: how to pass output of system commands to variable daweefolk Programming 1 01-25-2011 03:11 PM
How do I pass complicated commands (With bar's) as an argument to another script? theaceoffire Programming 8 04-22-2010 10:40 AM
how do i use php to pass commands onto a server? steve51184 Linux - Software 7 04-29-2009 03:24 AM
How to pass commands to asterisk CLI via bash script? Lordmonkey Linux - Newbie 3 03-24-2009 09:59 AM
How do I pass commands to the kernel? muxman Linux - General 2 05-18-2004 04:24 AM

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

All times are GMT -5. The time now is 03:05 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration