Why a terminal

Most calculations run on remote Linux clusters. A cluster has no desktop; you connect with ssh and work by typing commands. It helps to have the same kind of environment on your own machine, so you can prepare input files, run a small xtb job, and practise searching outputs with grep before you touch the cluster.

The terminal is the window where you type and read text. The program inside it that reads your commands and runs them is the shell. This guide uses bash, which is the default shell on nearly every cluster.

Windows: WSL2

WSL (Windows Subsystem for Linux) runs a real Linux system inside Windows. Version 2 (WSL2) uses an actual Linux kernel, so it behaves almost exactly like a cluster. On Windows 11 or a recent Windows 10 build, one command installs it.

  1. Find PowerShell in the Start menu, right-click it and choose Run as administrator.
  2. Run the command below and reboot when it finishes. Ubuntu is installed by default.
  3. After the reboot an Ubuntu window opens and asks for a Linux username and password. They do not need to match your Windows account.
# PowerShell (administrator)
wsl --install

# list installed distributions and their WSL version
wsl -l -v

Nothing appears on screen while you type the password. That is normal. You will need this password later for sudo when installing software. Once setup finishes, update the package lists.

$ sudo apt update && sudo apt upgrade

For the terminal window itself, use Windows Terminal. It ships with Windows 11; on Windows 10, get it from the Microsoft Store. Pick Ubuntu from the drop-down when opening a new tab.

Where your Windows files are

Inside WSL, the Windows C: drive appears as /mnt/c. Your desktop is usually at /mnt/c/Users/<Windows username>/Desktop. Going the other way, type explorer.exe . in a WSL terminal to open the current Linux directory in Windows Explorer.

Work in your Linux home

Keep calculation directories under your Linux home (~, which is /home/<user>), not under /mnt/c. /mnt/c is a bridge between the two systems: it is noticeably slow with many files, and it does not show permissions (chapter 04) properly. Files written with Windows Notepad also use different line endings, which causes its own problems (chapter 03).

macOS

macOS is a Unix system, so there is little to install. Open Applications → Utilities → Terminal. Many people prefer iTerm2 for its tabs and split panes.

Since macOS Catalina (10.15) the default shell has been zsh instead of bash. For interactive use the commands are nearly identical, and you can follow this guide as is. Two differences matter later: the bash that ships with macOS is the old version 3.2, and basic tools such as sed and date are BSD versions whose options differ from the GNU versions on Linux. A command that works on the cluster may fail on your Mac for that reason.

Install Apple's developer tools and the Homebrew package manager; most other software is easy to get after that.

# git, make, compilers: Xcode Command Line Tools
$ xcode-select --install

# Homebrew (the command from brew.sh)
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# a current bash and the GNU tools, if you need them
$ brew install bash coreutils

Linux

On a desktop Linux such as Ubuntu you are already set. Ctrl+Alt+T opens a terminal on Ubuntu, and the default shell is bash.

Other options

If you only need to connect to a cluster from Windows, ssh clients such as MobaXterm or PuTTY work too. MobaXterm has a built-in file transfer pane. These are windows onto a remote machine, though; they do not give you Linux locally. For practising and testing scripts on your own machine, WSL is the better choice.

The shell and the prompt

When a terminal opens you see a line like this with a blinking cursor after it. This is the prompt.

kim@laptop:~$
PartMeaning
kimThe user you are logged in as
laptopThe machine (host) name. On a cluster this becomes the login node's name.
~The current directory. ~ is short for your home directory.
$Waiting for input. For the administrator (root) it shows #.

zsh on macOS ends with % instead, as in kim@MacBook ~ %. The exact look depends on configuration, but you read it the same way. Because the host name is in the prompt, it tells you whether you are typing on your laptop or on the cluster.

First commands

Type a command and press Enter. Case matters: the command is pwd, not PWD.

$ whoami
kim
$ pwd
/home/kim
$ ls
$ date
Tue Sep 29 10:15:32 +08 2026
  • whoami: your username.
  • pwd (print working directory): the full path of the directory you are in.
  • ls (list): the files in the current directory. A fresh home directory is empty, so it prints nothing.
  • date: the current date and time.

Linux commands are often silent when they succeed. If the prompt comes back with no output, things usually went fine. When there is an error, read the whole message. command not found means the name was mistyped or the program is not installed.

Getting help

There is no need to memorise options. Most commands come with documentation.

# the full manual page; arrows or Space to scroll, q to quit
$ man ls

# a short summary of options
$ ls --help

Inside man, press / and type a word to search (the same keys as less in chapter 03). Some built-in macOS commands do not understand --help; use man there. Commands built into the shell, such as cd, are documented with help cd.

Copy, paste and useful keys

In a terminal, Ctrl+C does not copy. It interrupts the running command. That is why copy and paste shortcuts differ between programs.

TerminalCopyPaste
Linux (GNOME Terminal etc.)Ctrl+Shift+CCtrl+Shift+V
Windows TerminalCtrl+C with text selectedCtrl+V
macOS Terminal, iTerm2Cmd+CCmd+V
PuTTYSelecting with the mouse copiesRight-click
KeyWhat it does
↑ ↓Recall earlier commands
TabComplete file and command names (chapter 02)
Ctrl+CStop the running command, or discard the line you are typing
Ctrl+LClear the screen (same as clear)
Ctrl+A / Ctrl+EJump to the start / end of the line
Ctrl+RSearch your command history by text
Commands copied from the web

Copying from a web page or PDF sometimes turns straight quotes into curly ones (“ ”) or brings the leading $ along. Glance over a pasted command before pressing Enter.