Shell and Filesystems

Session 2

September 7, 2023

Review of last session

  • What questions do you have?
  • What happened as you were trying to re-organize projects or R code?
    • Victories?
    • Stumbling blocks?

Learning objectives

  • Understand the what and why of the shell
  • Use the shell to navigate your computer’s file system
  • Use R projects to simplify file system navigation
  • Know your options for finding help

What is the shell?

  • Command-line interface, in contrast to a GUI

Why learn the shell?

  • Be able to work with tools that don’t have a GUI
  • Batch large tasks (e.g. renaming files)
  • Interact with remote computers like the University HPC

Shell in this workshop

  • git/GitHub (next 2 lessons)
  • Navigating your file system
  • Quarto (lesson 9)

Let’s get set up!

  • macOS comes with a shell (usually Bash or Zsh) built-in

  • Windows need to install GitBash (includes Bash shell and git, which we will use later)

  • Breakout rooms

    • Mac users go with Kristina
    • Windows users go with Renata

Data download

Coding time

  • RStudio panes
  • Set up Terminal in RStudio
  • Navigation using Terminal and Files pane

Example file system

Example file system

Syntax of a shell command

Coding time

  • Synchronize working directories between Terminal, Files Pane, and R working directory

Coding time

  • Use an R project to simplify working directories
  • Copy shell_lesson_data to your R project

Getting help

ls --help
man ls

Getting help

git --help

Getting help

Getting help

Getting help

Getting help

Beware of stochastic parrots

  • LLMs don’t understand, but are good at mimicry
  • Use with care:
    • May be wrong
    • May be inconsistent

Beware of stochastic parrots

  • Tools like ChatGPT pose ethical issues
    • Plagiarism
    • Labor conditions
    • Inputs may be sent to parent companies

Getting help: fellow humans

Getting help: fellow humans

Takeaways

  • The shell is a command-line interface to the computer
  • The file system the shell sees is the same as your File Explorer tab
  • We can use the shell from the Terminal pane in RStudio
  • Find help from built-in manual pages, Google, (maybe) AI tools, or community

Homework for next time

Resources: Shell

Resources: AI tools

Resources: UA community