GhostKU
GhostKU

Reputation: 2108

How to run a screen with 4 tabs and different commands tunning in each?

I just want to run screen with 4 tabs (in the same window) And different commands should be executed in different tabs. E.g.

tab 1:

cd $folder
run_command_1

tab 2:

cd $folder
source bin/activate
python run.py

tab 3:

ping google.com

tab 4:

cd $folder
ls

Is there any way to do this using one script or alias?

Upvotes: 0

Views: 859

Answers (1)

ma-ti
ma-ti

Reputation: 134

You can do this using a custom .screenrc file:

$ screen -c ~/tmp/.screenrc4tabs

$ cat ~/tmp/.screenrc4tabs
...
<contents of ~/.screenrc>
...
screen -t csh 0
select 0
stuff "cd /path/to/folder;runCommand1^M"

screen -t csh 1
select 1
stuff "cd /path/to/folder;source bin/activate;python run.py^M"

<same for 2/3/...>

Upvotes: 3

Related Questions