-
Notifications
You must be signed in to change notification settings - Fork 4
Using tmux
tmux is an open-source terminal multiplexer. It allows multiple terminal sessions to be accessed simultaneously in a single window. (In other words, it allows you to edit a file using vim and run jshell for testing in the same terminal window!)
You can switch between sessions to save time while working on your code instead of having to close vim or switch around different terminals.
Starting a new tmux session.
$ tmux
By default, you can enter tmux’s command mode by using a keyboard sequence called the prefix shortcut. The default is CTRL+b
, but in PE node, the default is CTRL+a
. (You can customise the prefix shortcut by creating/editing the ~/.tmux.conf
file)
Hotkey | Description |
---|---|
CTRL+b % (i.e. CTRL+b SHIFT+5 ) |
Split current pane horizontally into two panes |
CTRL+b " (i.e. CTRL+b SHIFT+' ) |
Split current pane vertically into two panes |
CTRL+b o / CTRL+b ; / CTRL+b UP/DOWN/LEFT/RIGHT
|
Go to the next pane |
CTRL+b+UP/DOWN/LEFT/RIGHT |
Resize current pane |
CTRL+b [ UP/DOWN/LEFT/RIGHT (q to quit) |
Scrolling with keys |
CTRL+b x / exit
|
Close the current pane |
CTRL+b c
|
Create a new tab |
CTRL+b <number>
|
Switch to the tab at the specified number |
Let's say you're in the middle of a lab or PA and your computer loses connection to the internet or crashes. Thankfully, if you're using tmux, you can resume from where you left off by attaching to the previous tmux session.
$ tmux ls
This will list out all the running tmux sessions. An example output is:
0: 1 windows (created Wed Oct 13 11:13:50 2021)
Take note of the session name which is the string before the :
(in this case it is 0
) as you will need it in the next step. By default, the string should just be a number unless you explicitly named the session.
$ tmux attatch -t 0
This will attach to the session named 0
. You can replace 0
with the name of whatever session you would like to attach to.
Peer Learning
Guides
Setting Up Checkstyle
Setting Up Java
Setting Up MacVim
Setting Up Stu
Setting Up Unix For Mac
Setting Up Unix For Windows
Setting Up Vim
Setting up SSH Config
SSH Without Password
Copying Files From PE Nodes
Using tmux
CS2030 Contents
Lecture 1 SummaryLecture 2 Summary
Access Modifiers
Lecture 3 Summary (Polymorphism)
Compile Time Type VS Runtime Type
Abstraction, Encapsulation, Inheritance, and Polymorphism
SOLID Principles
Class VS Abstract Class VS Interface
Comparable VS Comparator
Generic Types T
HashMap
Raw Types with Generic
Lambda expression
PECS (Producer Extends Consumer Super)
Optional
Streams
Parallel Streams
Monad
Functors and Monads with Category Theory