• Home
  • About
  • Schedule
  • Sessions
  • Code of Conduct

Contents

  • Objectives
  • Tasks
  • Exercises
    • Exercise 1: Set up your research workspace
    • Exercise 2: Create project structure
    • Exercise 3: Create project documentation
    • Exercise 4: Set up data organization
    • Exercise 5: Add project metadata
    • Exercise 6: Organize and clean up
  • Slides
  • Solutions
  • Resources
  • References

Command Line

Starts at:

Friday, 11:00

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!

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.

Slides

NoteHow can I download the slides as a PDF file?

To export the slides to PDF, do the following:

  1. Toggle into Print View using the E key (or using the Navigation Menu).
  2. Open the in-browser print dialog (CTRL/CMD+P).
  3. Change the Destination setting to Save as PDF.
  4. Change the Layout to Landscape.
  5. Change the Margins to None.
  6. Enable the Background graphics option.
  7. Click Save.

Note: This feature has been confirmed to work in Google Chrome, Chromium as well as in Firefox.

Here’s what the Chrome print dialog would look like with these settings enabled:

These instructions were copied from the Quarto documentation (MIT License) and slightly modified.

Solutions

TipShow me the 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

Resources

  • Version Control Book: Command Line
  • The Missing Semester of Your CS Education: The Shell by MIT
  • Software Carpentry: The Unix Shell

References

© 2026 Dr. Lennart Wittkuhn

 

License: CC BY 4.0