Difference between revisions of "Tmux"

From Applied Optics Wiki
Jump to: navigation, search
(Created page with "Tmux is an incredibly simple and useful bit of software that lets you; *Tile multiple terminals into one screen *Allow you to log in to a running session, which you can detac...")
 
 
(2 intermediate revisions by the same user not shown)
Line 7: Line 7:
  
 
* Install Tmux <code>sudo apt-get install tmux</code>
 
* Install Tmux <code>sudo apt-get install tmux</code>
* Create a new Tmux session <code>tmux new -s [name of session]</code>
+
* Create a new Tmux session <code>tmux new -s [name of session]</code>, choose a name that makes sense and you can remember
 
* You will then be entered into a tmux session to start processes/work
 
* You will then be entered into a tmux session to start processes/work
 
* To leave the session running enter <code>crtl+b</code> then <code>d</code>
 
* To leave the session running enter <code>crtl+b</code> then <code>d</code>
 
* You can now log off and the Tmux session processes will continue running
 
* You can now log off and the Tmux session processes will continue running
  
* To get back onto your Tmux session <code>tmux attach-session -t [name of session]</code>
+
* To get back onto your Tmux session <code>tmux attach-session -t [name of session]</code> (or  <code>tmux attach</code> to go back to the most recent session)
 
* If you've forgotten what your session was called, you can list all <code>tmux ls</code>
 
* If you've forgotten what your session was called, you can list all <code>tmux ls</code>
 
* To close the session, enter the session and <code>exit</code>
 
* To close the session, enter the session and <code>exit</code>
Line 18: Line 18:
 
That's it. If you want be more advanced, these shortcuts will help;
 
That's it. If you want be more advanced, these shortcuts will help;
  
* Split your current terminal vertically <code>ctrl+b</code> <code>"</code>
+
* Split your current terminal vertically <code>ctrl+b</code> then <code>"</code>
* Split your current terminal horzontally <code>ctrl+b <code>%</code>
+
* Split your current terminal horzontally <code>ctrl+b</code> then <code>%</code>
 
* Move between your panes <code>ctrl+b</code> then <code>[arrow key]</code>
 
* Move between your panes <code>ctrl+b</code> then <code>[arrow key]</code>
 
* To resize panes <code>ctrl+b</code> then <code>:</code>, then type <code>resize-pane -[direction] [length]</code> where direction is U,D,L,R (up,down,left,right) and length is in number of lines
 
* To resize panes <code>ctrl+b</code> then <code>:</code>, then type <code>resize-pane -[direction] [length]</code> where direction is U,D,L,R (up,down,left,right) and length is in number of lines

Latest revision as of 08:14, 24 May 2021

Tmux is an incredibly simple and useful bit of software that lets you;

  • Tile multiple terminals into one screen
  • Allow you to log in to a running session, which you can detach from (keeping an processes going) and log off.

There are a number of online tutorials for the first point, but below are the basics for the second;

  • Install Tmux sudo apt-get install tmux
  • Create a new Tmux session tmux new -s [name of session], choose a name that makes sense and you can remember
  • You will then be entered into a tmux session to start processes/work
  • To leave the session running enter crtl+b then d
  • You can now log off and the Tmux session processes will continue running
  • To get back onto your Tmux session tmux attach-session -t [name of session] (or tmux attach to go back to the most recent session)
  • If you've forgotten what your session was called, you can list all tmux ls
  • To close the session, enter the session and exit

That's it. If you want be more advanced, these shortcuts will help;

  • Split your current terminal vertically ctrl+b then "
  • Split your current terminal horzontally ctrl+b then %
  • Move between your panes ctrl+b then [arrow key]
  • To resize panes ctrl+b then :, then type resize-pane -[direction] [length] where direction is U,D,L,R (up,down,left,right) and length is in number of lines