Shell & Terminal

The command line is your primary interface to the AIRLab servers. This guide covers the basics of connecting, navigating, and managing your work through the shell.

Connecting via SSH

SSH (Secure Shell) creates an encrypted connection to the server. The server IPs are internal — ask your co-supervisor for them. To avoid typing raw IPs, add them to your system's hosts file as memorable aliases:

/etc/hostsC:\Windows\System32\drivers\etc\hosts
text
# AIRLab servers — replace with actual IPs from your co-supervisor
<WESTWORLD_IP>   westworld ww
<ELYSIUM_IP>     elysium   ely
# AIRLab servers — replace with actual IPs from your co-supervisor
<WESTWORLD_IP>   westworld ww
<ELYSIUM_IP>     elysium   ely

Note: You cannot directly overwrite this file with Notepad. Save the edited file anywhere on your desktop, then drag and drop it into C:\Windows\System32\drivers\etc\ to overwrite it (administrator permission required).

Then configure your SSH client to handle usernames and key selection automatically. Add the following to your SSH config file (create it if it doesn't exist):

~/.ssh/configC:\Users\YourName\.ssh\config
text
# Westworld
Host ww westworld
  HostName westworld
  User lastname    <-- replace with your actual username on the server
  IdentityFile ~/.ssh/id_ed25519_airlab
  ServerAliveInterval 60
  ServerAliveCountMax 3

# Elysium
Host ely elysium
  HostName elysium
  User lastname    <-- replace with your actual username on the server
  IdentityFile ~/.ssh/id_ed25519_airlab
  ServerAliveInterval 60
  ServerAliveCountMax 3
# Westworld
Host ww westworld
  HostName westworld
  User lastname    <-- replace with your actual username on the server
  IdentityFile ~/.ssh/id_ed25519_airlab
  ServerAliveInterval 60
  ServerAliveCountMax 3

# Elysium
Host ely elysium
  HostName elysium
  User lastname    <-- replace with your actual username on the server
  IdentityFile ~/.ssh/id_ed25519_airlab
  ServerAliveInterval 60
  ServerAliveCountMax 3

With this in place, connecting to any server is just:

local machine
bash
ssh ww      # westworld
ssh ely     # elysium

After editing ~/.ssh/config, host names get tab-autocomplete in your terminal. You can also open remote folders directly in VS Code with the Remote - SSH extension using these same aliases.

SSH Keys

Password authentication is convenient but weaker than key-based authentication. Set up an SSH key pair once and never type your password over the network again.

local machine
bash
# 1. Generate a key pair (Ed25519 is the modern standard)
# The -C comment is optional but helps identify the key later
ssh-keygen -t ed25519 -C "airlab" -f ~/.ssh/id_ed25519_airlab

# 2. Copy the public key to every server you use
ssh-copy-id -i ~/.ssh/id_ed25519_airlab.pub lastname@<westworld_ip>
ssh-copy-id -i ~/.ssh/id_ed25519_airlab.pub lastname@<elysium_ip>

# 3. Test key login — no password prompt means it worked
ssh ww
# 1. Generate a key pair (Ed25519 is the modern standard)
# The -C comment is optional but helps identify the key later
ssh-keygen -t ed25519 -C "airlab" -f C:\Users\YourName\.ssh\id_ed25519_airlab

# 2. Windows does not have ssh-copy-id — use PowerShell instead
type C:\Users\YourName\.ssh\id_ed25519_airlab.pub | ssh lastname@<westworld_ip> "mkdir -p .ssh && cat >> .ssh/authorized_keys"
type C:\Users\YourName\.ssh\id_ed25519_airlab.pub | ssh lastname@<elysium_ip> "mkdir -p .ssh && cat >> .ssh/authorized_keys"

# 3. Test key login — no password prompt means it worked
ssh ww

GitHub on the Server

You will want to git clone and git push directly from the compute servers. The easiest way is to connect remotely with VSCode's Remote - SSH extension and use the built-in Git integration. More on that in the VS Code Integration section of the Docker guide.

CommandWhat it doesExample
pwdPrint current directorypwd
lsList directory contentsls -lah
cdChange directorycd ~/dataset/private
mkdirCreate a directorymkdir -p results/run_01
cpCopy files or directoriescp -r src/ backup/
mvMove or renamemv old_name.py new_name.py
rmDelete filesrm -rf results/old_run/
catPrint file contentscat config.yaml
lessPage through a fileless training.log
grepSearch inside filesgrep "val_loss" training.log
findSearch for filesfind . -name "*.pt"
duDisk usagedu -sh ~/dataset/private/*
rm -rf has no undo. On a shared server there is no trash bin and no backup for your home directory. Double-check the path before pressing Enter, every single time.

Useful patterns

bash
# Search command history
history | grep docker

# Count lines in a file
wc -l training.log

# Sort and unique a list
cat labels.txt | sort | uniq -c | sort -rn

# Extract a .tar.gz archive into a specific directory
tar -xzf dataset.tar.gz -C ~/storage_megaverse

Monitoring Resources

Before starting an experiment, always check that the resources you booked are actually free.

bash
# CPU, RAM, and per-process stats (interactive — press q to quit)
htop

# Full GPU status: memory usage, utilisation, running processes
nvidia-smi

# Find who owns a process by surname
ps aux | grep surname

# Watch GPU utilisation live every 2 seconds
watch -n 2 nvidia-smi

Tmux — Persistent Terminal Sessions

Training a neural network can take hours or days. If your SSH connection drops — due to a network hiccup, a laptop going to sleep, or a VPN timeout — any process running directly in your terminal will be killed. tmux solves this by running your shell sessions on the server, completely independent of your connection. Detach, close your laptop, and reattach later to find everything exactly as you left it.

The key concept: Ctrl-b is the prefix — press it before every tmux shortcut, then release it before pressing the next key. A full cheat sheet is available here.

Quick start

westworld
bash
# Create a named session (use a meaningful name — your project or experiment)
tmux new -s resnet_training

# Inside the session, start your experiment as normal
run-docker 0 0-8 "python train.py"

# Detach — your experiment keeps running on the server
# Press: Ctrl-b  then  d

# Later, reattach from any SSH session
tmux attach -t resnet_training

Sessions

ActionCommand / Shortcut
Create a new named sessiontmux new -s name
List all sessionstmux ls
Attach to a sessiontmux attach -t name
Detach from current sessionCtrl-b d
Rename current sessionCtrl-b $
Kill a sessiontmux kill-session -t name
Clean up after yourself. Kill sessions when experiments finish with tmux kill-session -t name.

Windows & Panes

A session can contain multiple windows (like browser tabs), and each window can be split into panes (side-by-side or stacked terminals).

ActionShortcut
New windowCtrl-b c
Switch to window by numberCtrl-b 0–9
Next / previous windowCtrl-b n / p
Rename current windowCtrl-b ,
Close current windowCtrl-b &
Split pane vertically (side by side)Ctrl-b %
Split pane horizontally (top/bottom)Ctrl-b "
Move between panesCtrl-b ↑↓←→
Zoom pane to full screenCtrl-b z
Close current paneCtrl-b x

Configuration

tmux is highly customizable. Create a ~/.tmux.conf file to set your preferred keybindings, status bar, colors, and more. Here's a sample config to get you started:

~/.tmux.conf
bash
# Enable mouse support (click to select panes/windows, scroll history)
set -g mouse on

# Start window and pane numbering at 1
set -g base-index 1
set -g pane-base-index 1

# Increase scrollback history
set -g history-limit 50000

# Faster key repetition
set -sg escape-time 0

# Reload config with: Ctrl-b r
bind r source-file ~/.tmux.conf ; display-message "Config reloaded"

# Intuitive pane splitting (opens in current directory)
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"

# Status bar
set -g status-right '%H:%M %d-%b'
set -g status-style 'bg=#102c53 fg=white'
bash
# Reload config without restarting tmux
tmux source-file ~/.tmux.conf
# Or inside a session: Ctrl-b r