Click the virtual machine below to start practicing
- Setting up virtual machine…
- Preparing lab files…
- Starting terminal services…
This lab machine has stopped
Your progress through the guide is saved. Start a fresh machine to keep practicing.
Click the virtual machine below to start practicing
Your progress through the guide is saved. Start a fresh machine to keep practicing.
From the last lab. Answer in your head, then open to check.
tmux send-keys -t name 'command' Enter.build:0.1 mean?build, window 0, pane 1.Instead of rebuilding windows and panes by hand every morning, script them. Run one command and your workspace is there.
A workspace script builds everything detached (-d), so nothing flashes past while it runs, and attaches only at the end.
Run it twice and new-session fails ("duplicate session") while the other commands happily add more windows to the existing session. Real scripts check first with tmux has-session -t name, and the next challenge asks for exactly that.
Create ~/project/dev.sh (e.g. nano dev.sh):
#!/bin/bash
tmux new-session -d -s dev -n editor
tmux new-window -t dev -n server
tmux split-window -v -t dev:server
tmux select-window -t dev:editor
tmux attach -t dev
It makes a session with an editor window and a server window split top and bottom, then opens it on editor.
bash dev.sh
You land in editor. Ctrl-b n shows the split server window.
A few tmux commands in a script rebuild your whole layout. Keep one per project, and starting work is one command.