Skip to content

Commit

Permalink
big changes to shell lesson
Browse files Browse the repository at this point in the history
  • Loading branch information
diazrenata committed Aug 25, 2023
1 parent 309f41f commit 1e71248
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 37 deletions.
Binary file added lessons/2-shell/drop-ins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lessons/2-shell/getwd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lessons/2-shell/gpt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lessons/2-shell/man_page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 31 additions & 26 deletions lessons/2-shell/notes.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,38 @@ format: html
- Split into 2 breakout rooms to install on different OS's.
- Break to all download shell-lesson-data
- Link
- Put it somewhere high in the file system (Desktop)
- Unzip using command line unzip (or just point-and-click in computer file system?)
- Live coding: Intro to the terminal pane in RStudio
- Quick tour of RStudio panes
- Emphasize files pane, analogous to Finder/File Explorer
- Navigate to shell-lesson-data
- Everyone set up to use bash with Terminal pane
- Show navigation to Current Directory in Terminal pane in RStudio
- Make sure everyone ends up in shell-lesson-data
- Live coding: Unix Shell lesson 1
- https://swcarpentry.github.io/shell-novice/01-intro
- (a lot of the text the content of this lesson will be covered in the slides section above)
- Put it on your Desktop
- Unzip using point-and-click
- Live coding: Setup RStudio
- Open RStudio
- Tour panes: files and terminal
- Set up terminal pane to use bash
- Live coding: Navigating filesystems in files pane
- Use file pane to navigate to shell-lesson-data
- Live coding: Navigate to shell-lesson-data in Terminal
- Identify the prompt and note that it is different in zsh (%)
- Introduce ls
- Introduce `command not found`
- Introduce general anatomy of a shell prompt (Slide/share image)
- Live coding: Unix Shell lesson 2
- `pwd` and file systems
- Using options and getting help
- Navigating around file systems
- (Time-permitting) live coding: Unix Shell lesson 3
- Creating directories
- Creating and editing text files
- Moving and renaming files and directories
- Copying
- Removing
- Wildcards
- `pwd`
- `cd`
- `ls`
- Use `ls` flags to explain anatomy of a shell command
- Show `man ls` to show flag options for the `ls` command
- Live coding: Synchronizing file panes
- Show "Go to current directory" to bring Terminal to files pane
- Show "New terminal here" to create a terminal in files pane
- Show that Rstudio's working directory is not automatically wherever either Terminal or the file pane is
- Live coding: using Rprojects to simplify filesystems
- Create an R project
- Show that, upon opening, Terminal, getwd(), and file pane are all on the same page
- Live coding: `cp` and `move`
- Copy `shell_lesson_data` to the Rproject.
- Tell them we need `cp`, then use `man cp` to get the options
- Repeat using `ls` to explore contents of `shell_lesson_data` and mirror files pane
- Live coding/discussion: options for finding help
- `--help` flag
- `man` pages
- Manual pages: `?` in R, package websites
- StackOverflow
- ChatGPT
- Homework for next session
- Read <https://peerj.com/preprints/3159/> git (Version control prep)
- Create a diagram of your file system and note your most frequently used directories
Expand Down
110 changes: 99 additions & 11 deletions lessons/2-shell/slides.qmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Shell Commands"
title: "Shell and Filesystems"
subtitle: "Session 2"
# date: TODO
format: revealjs
Expand All @@ -16,10 +16,9 @@ footer: "[Reproduciblity & Data Science in R](../../index.html)"
# Learning objectives

- Understand the what and why of the shell
- Interact with the shell using common commands
- Find help via --help, man, and online help pages
- Navigate your file system from the command line
- (Time permitting) Manipulate and move files from the command line
- 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?

Expand All @@ -31,13 +30,21 @@ footer: "[Reproduciblity & Data Science in R](../../index.html)"
- 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 Eric
- Windows users go with Renata

# Data download

Expand All @@ -47,25 +54,106 @@ footer: "[Reproduciblity & Data Science in R](../../index.html)"

# Coding time

- Intro to shell commands
- RStudio panes
- Set up Terminal in RStudio
- Navigation using Terminal and Files pane

# Example file system

![](file-path-example.png)

# Example file system

![](file-structure-example.png)

# Syntax of a shell command

![](shell_syntax.png){fig-align="center"}

# Coding time

- File systems
- Synchronize working directories between Terminal, Files Pane, and R working directory

# Example file system
# Coding time

![](file-path-example.png)
- Use an R project to simplify working directories
- Copy `shell_lesson_data` to your R project

# Getting help

```bash
man ls
```

# Getting help

```bash
git --help
```

# Getting help

![](getwd.png){fig-align="center"}

# Getting help

![](man_page.png){fig-align="center"}


# Getting help

![](stack_overflow.png){fig-align="center"}

# Getting help

![](gpt.png){fig-align="center"}

# 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

![](ua-ds-slack.png){fig-align="center"}


# Getting help: fellow humans

![](drop-ins.png){fig-align="center"}

# Example file system

![](file-structure-example.png)

# Homework for next time

- Read ["Excuse me, do you have a moment to talk about version control?"](https://peerj.com/preprints/3159/)
- Create a diagram of your file system and note your most frequently used directories

# Resources: Shell

- [Software Carpentry Unix Shell episode #1](https://swcarpentry.github.io/shell-novice/01-intro)
- [Software Carpentry Unix Shell episode #2](https://swcarpentry.github.io/shell-novice/02-filedir)
- [Software Carpentry Unix Shell episode #3](https://swcarpentry.github.io/shell-novice/03-create)

# Resources: AI tools

- <https://ecoevo.social/@cboettig/110934209180569370>
- <https://www.infoworld.com/article/3694611/8-chatgpt-tools-for-r-programming.html>
- <https://en.wikipedia.org/wiki/Stochastic_parrot>
- <https://dl.acm.org/doi/abs/10.1145/3442188.3445922>
- <https://medium.com/@konstantine_45825/chatgpt-is-no-stochastic-parrot-but-it-also-claims-that-1-is-greater-than-1-e3cd1fc303e0>

# Resources: UA community

- [UA Data Science Institute](https://datascience.arizona.edu/)
- [UA Data Science Slack](https://jcoliver.github.io/uadatascience-slack/)
- [CCT Drop-in Hours, 9-10 on Tuesdays](https://datascience.cct.arizona.edu/drop-in-hours)
Binary file added lessons/2-shell/stack_overflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lessons/2-shell/ua-ds-slack.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e71248

Please sign in to comment.