Computational-Social-Science-Training-Program icon indicating copy to clipboard operation
Computational-Social-Science-Training-Program copied to clipboard

BashGit Lab

Open Akesari12 opened this issue 5 years ago • 5 comments

In-Class Lab for working with git and bash tools.

Akesari12 avatar Jul 29 '20 19:07 Akesari12

@EastBayEv , @aculich, getting your eyes on these first two labs would be great! A lot of this is based on D-Lab's BashGit. Any comments/suggestions/corrections welcome. Here's the link: https://github.com/dlab-berkeley/Computational-Social-Science-Training-Program/tree/master/Reproducible%20Data%20Science

Also, if we could follow up about getting the students onboarded to benten or another remote server for the ssh part of the command line, that would be awesome.

Akesari12 avatar Aug 06 '20 00:08 Akesari12

@Akesari12 @EastBayEv continuing the conversation for now in Slack in #curriculum-development

We can use this github issue to document the final answer that we come to in the Slack conversation.

For now, try running the notebooks using this link for the campus datahub:

https://datahub.berkeley.edu/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fdlab-berkeley%2FComputational-Social-Science-Training-Program&urlpath=tree%2FComputational-Social-Science-Training-Program%2F&branch=master

aculich avatar Aug 12 '20 18:08 aculich

@Akesari12 I strongly recommend teaching using SSH protocol for git push and pull. It's quicker and safer way to use GitHub.

  • Step 1: Set up to connect to GitHub using SSH: https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh

  • Step 2: Type git remote set-url origin [email protected]:user/repo in the command line.

No longer needs to type id and pw to push and pull.

jaeyk avatar Aug 13 '20 04:08 jaeyk

@Akesari12 For the bash part, consider teaching writing and executing a sh file.

an example

#!/bin/sh

#! part called shebang

blah blah

let's say you name the file test.sh

you can make it executable by

$ chmod +x test.sh

chmod = change mode

+x is a file permission parameter and means executable

then you can execute the file by

$ ./test.sh

jaeyk avatar Aug 13 '20 04:08 jaeyk

@Akesari12 For the bash, also consider teaching cat, less, and head.

In the following examples, text means any kind of flat file like CSV, TXT, etc.

cat: print a small text file (print everything) less: print a large text file (you need to enter to scroll down lines) head: print first n lines in a text file. head -n 1 print first 5 lines in a text file. Note that -n does not mean negative n - indicates a parameter will be followed.

I also use awk, grep, find, and echo a lot.

jaeyk avatar Aug 13 '20 04:08 jaeyk