Skip to content

Linux and bash scripting

Alexander Holmes edited this page Jul 5, 2023 · 8 revisions

Introduction

Your MASSIVE desktop uses an operating system called Linux, which is a Unix-like operating system. It basically works just like the Windows or Macintosh operating systems that you might be more familiar with, but with a greater emphasis on command line usage than menus for navigation.

This means you’ll want to open what is known as a terminal, where you can run text based commands to open and move files or even run different software programs. Bash is a language used in Linux to write these text based commands.

When running software on MASSIVE specifically, you’ll often need to load specific modules before you get started in the terminal you’re currently running.

The Basics

Before you run any software, you’ll need to be familiar with the basic syntax of bash.

Andy’s Brain Book provides an excellent introduction to Unix through a neuroimaging lens. We suggest using this to familiarise yourself with Linux/bash. See the intro here.

  • Lessons 1-4 will cover general commands for navigating file systems and directory trees.

  • Lessons 5-6 will cover for loops and if else statements (even if you’re familiar with these operations in another language, the syntax can still vary in bash).

  • Lessons 7-9 will cover writing and running scripts that will allow you to interact with your data, run your analyses, or anything else you wish to do with your code

MASSIVE-specific adaptations

Because of the way MASSIVE is arranged, there are a few things you will have to do slightly differently when following this tutorial on MASSIVE.

Lesson 2

  • Right-click on the desktop > ‘Create a File’ > name it ‘myFile.txt’
  • Right-click on the desktop again > ‘Open a Terminal’
  • Then follow the instructions using ls, cp, mv, rm
  • Alternatively, you can use the text editor in MASSIVE by going to Applications > Full List of Apps > gedit

Lesson 4 // TODO need to give instructions re. FSL as this cannot be downloaded