Terminal basics¶
layerbn has no graphical interface. You use it by typing commands in a terminal, also called the command line, shell or console. This page covers the commands you need.
Opening a terminal¶
Press Cmd+Space, type Terminal and press Enter.
Press the Win key, type PowerShell and press Enter. Command Prompt also works, but the examples in this documentation use PowerShell.
The terminal shows a line ending in %, $ or >. This is the prompt. Type a command
after it and press Enter to run it.
The working folder¶
A terminal always has a current folder, the working folder. Commands read files from this folder and write new files to it.
| Task | macOS | Windows |
|---|---|---|
| Show the current folder | pwd |
pwd |
| List the contents of the folder | ls |
dir |
| Move into a folder | cd my-study |
cd my-study |
| Move up one folder | cd .. |
cd .. |
| Move to the Documents folder | cd ~/Documents |
cd $HOME\Documents |
| Open a file in its default application | open results/report.html |
start results\report.html |
| Open the current folder in Finder or Explorer | open . |
explorer . |
Entering a path
Type cd and a space, then drag the folder from Finder or Explorer into the terminal
window. The terminal inserts the full path. Press Enter.
You can also press Tab while typing a file or folder name to complete it.
Paths with spaces
Folder names such as My analyses or OneDrive - UMC Utrecht contain spaces. Enclose
these paths in quotes; otherwise the terminal reads them as separate words:
Inside quotes, use $HOME for your home folder. ~ only works without quotes.
When you drag a folder into the terminal, the quotes or escape characters are added automatically.
layerbn commands¶
| Command | Description |
|---|---|
layerbn init my-study |
Create a project folder with the example study |
layerbn init my-cohort --blank |
Create an empty project folder for your own data |
cd my-cohort |
Move into the project folder |
layerbn check --figure |
Check the files and data, and draw the layers |
layerbn run --fast |
Run a quick trial analysis |
layerbn run |
Run the full analysis |
Run check and run from inside the project folder. From another folder, add the
project folder to the command, for example layerbn run my-cohort.
Continuing after closing the terminal
All work is saved in files. Open a new terminal and use cd to move to the project
folder. If you installed layerbn in a virtual environment (see Install),
activate it first.