Difference between revisions of "Linux multi window terminal Screen and Tmux"

From Ever changing code
Jump to navigation Jump to search
(Created page with "Screen allows for multi window connection using a single ssh session. It also allows to detach from the session screen while still running a remote session. = Install = sudo...")
 
Line 13: Line 13:
By default the config is kept in <code>~/.screenrc</code> file but using -c option we can pass a custom config
By default the config is kept in <code>~/.screenrc</code> file but using -c option we can pass a custom config


  ~$ screen -c screen-pm
  ~$ screen -c screen-4regions


Config file example
Config file example
Line 19: Line 19:
  screen -t mail1-queue    #creates new terminal/prompt
  screen -t mail1-queue    #creates new terminal/prompt
  select 0                  #select window0
  select 0                  #select window0
  stuff "Window0^M"  #echo a string between quotes, ^M translates to EOL
  stuff "echo Window0^M"  #echo a string between quotes, ^M translates to EOL
    
    
  split      #split horizontally
  split      #split horizontally

Revision as of 17:46, 22 August 2016

Screen allows for multi window connection using a single ssh session. It also allows to detach from the session screen while still running a remote session.

Install

sudo apt-get install screen

Useful key bindings

C^a c -create new prompt
C^a tab -move to a next window
C^a | -split vertically
C^a S -split horizontly

Custom configuration

By default the config is kept in ~/.screenrc file but using -c option we can pass a custom config

~$ screen -c screen-4regions

Config file example

~$ cat screen-pm 
screen -t mail1-queue     #creates new terminal/prompt
select 0                   #select window0
stuff "echo Window0^M"   #echo a string between quotes, ^M translates to EOL
 
split      #split horizontally
split -v   #split vertically

select 1
focus      #get focus on a selected window
screen -t mail2-queue   #create a new terminal/prompt in the focus window
stuff "echo Screen1^M"

select 2
focus
screen -t mail1
stuff "echo Screen2^M"

split -v

select 3
focus
screen -t mail2
stuff "echo Screen3^M"

altscreen on                                                                                       
term screen-256color                                                                               
bind ',' prev                                                                                      
bind '.' next                                                                                      
#                                                                                                  
#change the hardstatus settings to give an window list at the bottom of the                        
#screen, with the time and date and with the current window highlighted                            
hardstatus alwayslastline                                                                          
#hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'              
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W}%c %{g}]'