Command Line

FAIR & Reproducible Teaching with Quarto & Git
Course at University of Hamburg
Slides | Source
License: CC BY 4.0

11:00

Schedule

Day Date Time Title
1 2026-03-20 09:30 - 10:00 Welcome & Introduction
1 2026-03-20 10:00 - 10:30 Quarto: Introduction
1 2026-03-20 10:30 - 10:45 Quarto: Presentations
1 2026-03-20 10:45 - 11:00 Git: Setup & Configuration
1 2026-03-20 11:00 - 11:15 Command Line
1 2026-03-20 11:15 - 12:00 Git: Basics
1 2026-03-20 12:00 - 13:00 Lunch Break
1 2026-03-20 13:00 - 14:00 Git: Remotes
1 2026-03-20 14:00 - 15:00 Git: Collaboration
1 2026-03-20 15:00 - 15:30 Quarto: Publication to GitHub Pages
1 2026-03-20 15:30 - 16:00 Git: Tags & Releases

1 Command Line

This session: Command Line

Source: Wikimedia Commons (free license)

Objectives

💡 You can name the advantages of command-line interfaces.
💡 You can navigate directories using absolute and relative paths.
💡 You can use shortcuts like the tilde or dots to navigate your file system.
💡 You can apply arguments and flags to customize command-line commands.
💡 You can use wildcards (*) for file selection.
💡 You can combine command-line commands.

Tasks

In this session, you will work on the following tasks:

  1. Reading: Read the chapter(s) Command Line in the Version Control Book.
  2. Implementation: Try out the commands in the chapter.
  3. Exercises: Work on the exercises.

As always:

  1. Try out the commands of this session and play around with them.
  2. Check whether you have achieved the learning objectives.
  3. Ask questions!

Reading

Command Line

Tasks

In this session, you will work on the following tasks:

  1. Reading: Read the chapter(s) Command Line in the Version Control Book.
  2. Implementation: Try out the commands in the chapter.
  3. Exercises: Work on the exercises.

As always:

  1. Try out the commands of this session and play around with them.
  2. Check whether you have achieved the learning objectives.
  3. Ask questions!

Exercises

Use only command line commands for all tasks.

Exercise 1: Set up your research workspace

  1. Navigate to a folder where you want to keep course-related files and display its path.
  2. Create a new directory called my-research-project.
  3. Navigate into this directory and confirm your location.

Exercise 2: Create project structure

  1. Create three subdirectories inside your research project: data, scripts, and docs.
  2. List all contents and verify the directories were created.
  3. Navigate into the docs directory.

Exercise 3: Create project documentation

  1. While in the docs directory, create a file called README.md.
  2. Add the text “# My Research Project” to this file.
  3. List the directory contents and confirm the file was created.

Exercise 4: Set up data organization

  1. Navigate to the data directory.
  2. Create two subdirectories: raw and processed.
  3. Navigate to the raw directory and create three sample data files: experiment1.csv, experiment2.csv, and survey.txt.

Exercise 5: Add project metadata

  1. Navigate back to your main project directory.
  2. Create three files: project-notes.txt, todo-list.md, and references.bib.
  3. Use wildcards to list only the .txt files in your project.

Exercise 6: Organize and clean up

  1. Create a new directory called archive.
  2. Move all .txt files from your main project directory into the archive directory.
  3. Display the full directory tree of your project and see the final structure.

Solutions

Exercise 1: Set up your research workspace

  1. Navigate to your home directory and display its path:
cd ~
pwd
  1. Create a new directory called my-research-project:
mkdir my-research-project
  1. Navigate into this directory and confirm your location:
cd my-research-project
pwd

Exercise 2: Create project structure

  1. Inside your research project, create three subdirectories: data, scripts, and docs:
mkdir data scripts docs
  1. List all contents to verify the directories were created:
ls
  1. Navigate into the docs directory:
cd docs

Exercise 3: Create project documentation

  1. In the docs directory, create a file called README.md:
touch README.md
  1. Add the text “# My Research Project” to this file:
echo "# My Research Project" > README.md
  1. List the directory contents to confirm the file was created:
ls

Exercise 4: Set up data organization

  1. Navigate to the data directory:
cd ../data
  1. Create two subdirectories: raw and processed:
mkdir raw processed
  1. In the raw directory, create three sample data files: experiment1.csv, experiment2.csv, and survey.txt:
touch experiment1.csv experiment2.csv survey.txt

Exercise 5: Add project metadata

  1. Navigate back to your main project directory:
cd ../../
  1. Create three files: project-notes.txt, todo-list.md, and references.bib:
touch project-notes.txt todo-list.md references.bib
  1. Use wildcards to list only the .txt files in your project:
ls *.txt

Exercise 6: Organize and clean up

  1. Create a new directory called archive:
mkdir archive
  1. Move all .txt files from your main project directory into the archive directory:
mv *.txt archive/
  1. Display the full directory tree of your project to see the final structure:
tree
# or if tree is not installed:
ls -R