LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-27-2012, 07:43 PM   #1
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Rep: Reputation: 22
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, 08:38 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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, 10:12 PM   #3
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

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

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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-27-2012, 11:54 PM   #5
Basher52
Member
 
Registered: Mar 2004
Location: .SE
Distribution: Arch
Posts: 401

Original Poster
Rep: Reputation: 22
still gonna look into it
tnxs y'all
 
Old 08-28-2012, 02:26 AM   #6
Roken
Member
 
Registered: Oct 2011
Location: Warrington, UK
Distribution: Arch local, Debian on VPS, several RPIs.
Posts: 300
Blog Entries: 1

Rep: Reputation: 55
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, 06:26 AM   #7
mjolnir
Member
 
Registered: Apr 2003
Posts: 815

Rep: Reputation: 99
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



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

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

All times are GMT -5. The time now is 01:29 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
Open Source Consulting | Domain Registration