Linux Cheat Sheet
Instructions in the documentation assume some knowledge of Linux commands. Any Linux command needed for setting up or running the tool can be found in the table below.
In the Command column, characters that are enclosed in parentheses are buttons (e.g., (Esc) is the escape key). Characters that are enclosed in a single quote are the command that should be typed.
Linux Commands for Navigating Directories
Regardless of operating system, there are a few commands that you will need to use to navigate directories to set up and run the model.
Command | Usage | Example |
---|---|---|
`mkdir` [name] | creates a new child directory in the current directory | `mkdir data` will make a directory called data |
`cp [filename] [destination]` | makes a copy of your file | `cp control_file.txt stack_data_control.txt` will make a copy of the control_file.txt file and name it stack_data_control.txt |
`pwd` | shows which directory you are currently in | `pwd` returns /home/koolik/isrm_health_calculations |
`ls` | shows all of the files in the current directory | `ls` will report a list of file names |
`cd` | changes directory | `cd data` will move into a child directory called "data" |
`cd ..` | moves upwards a directory (i.e., to the parent) | `cd ..` when in the home/data folder will go back up to the parent folder (home) |
Linux Commands for Editing Documents
If you are running the model on a remote Linux terminal (e.g., Google Cloud console), you will need to be able to edit documents through the terminal.
Command | Usage | Example |
---|---|---|
`vi` [filename] | opens a document | `vi control_file.txt` will open the control file |
`i` | switches you into edit mode | `i` then add your edits where appropriate |
(`Esc`) + `:q` | closes a document | `:q` will close a document without changes |
(`Esc`) + `:wq` | closes a document | `:wq` will close a document with changes |
Other Useful Commands
There are a few other useful commands that are used throughout the documentation.
Command | Usage | Example |
---|---|---|
`sudo` [function] | allows a user to execute commands with superuser privileges | `sudo apt-get update` will enable a non-administrator to run the update function from the apt-get command |
`git pull origin` | synchronizes your version of the code with the online repository | `git pull origin` will make your local copy (i.e., on your machine) match the remote version on Github. This makes sure you're never out of date. |