Learning Objectives

The Command Line

Useful Commands:

Other commands.

String search with grep

Find any string in any file in the current working directory (or subdirectories or the current working directory).

grep -rnw -e "move"
01_basic_bash.Rmd:93:  paths in R, using two periods mean "move back a folder". 
01_basic_bash.Rmd:100:    - If you use `cd` without specifying a folder to move to, it will move the 
01_basic_bash.Rmd:108:    - OK, I'm going to move us back to the 01_git directory.  
01_basic_bash.Rmd:200:grep -rnw -e "move"
01_git_github.Rmd:69:- You can go back to previous versions of your code/text, then move forward to 
01_git_github.Rmd:226:- Then move into your new repo
.Rhistory:2:grep -rnwe "move"
grep -rnw -e "mov"
01_basic_bash.Rmd:204:grep -rnw -e "mov"
01_basic_bash.Rmd:208:grep -rn -e "mov"
grep -rn -e "mov"
01_basic_bash.Rmd:93:  paths in R, using two periods mean "move back a folder". 
01_basic_bash.Rmd:100:    - If you use `cd` without specifying a folder to move to, it will move the 
01_basic_bash.Rmd:108:    - OK, I'm going to move us back to the 01_git directory.  
01_basic_bash.Rmd:168:- `rm`: Remove a file.
01_basic_bash.Rmd:182:- `rmdir`: Remove a directory/folder.
01_basic_bash.Rmd:200:grep -rnw -e "move"
01_basic_bash.Rmd:204:grep -rnw -e "mov"
01_basic_bash.Rmd:208:grep -rn -e "mov"
01_basic_bash.Rmd:233:I'll remove that file now
01_git_github.Rmd:69:- You can go back to previous versions of your code/text, then move forward to 
01_git_github.Rmd:226:- Then move into your new repo
01_git_github.Rmd:398:- Lines after a "`+`" are being added. Lines after a "`-`" are being removed.
.Rhistory:2:grep -rnwe "move"
.Rhistory:9:conda_remove(envname = "r-reticulate")
.Rhistory:11:conda_remove("bs4")

Download data with wget

Non-interactive downloading of data.

Not available for Git Bash for Windows.

E.g. to download the HTML file that contains the Wikipedia list of theological demons, we can go

wget -nc -nd https://en.wikipedia.org/wiki/List_of_theological_demons
--2022-11-16 13:29:02--  https://en.wikipedia.org/wiki/List_of_theological_demons
Resolving en.wikipedia.org (en.wikipedia.org)... 208.80.154.224, 2620:0:861:ed1a::1
Connecting to en.wikipedia.org (en.wikipedia.org)|208.80.154.224|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 79328 (77K) [text/html]
Saving to: ‘List_of_theological_demons’

     0K .......... .......... .......... .......... .......... 64% 15.2M 0s
    50K .......... .......... .......                         100% 22.6M=0.004s

2022-11-16 13:29:02 (17.2 MB/s) - ‘List_of_theological_demons’ saved [79328/79328]
ls
01_basic_bash.Rmd
01_figs
01_git_branch.Rmd
01_git_github.Rmd
01_git_lfs.Rmd
01_git_setup.Rmd
blischak_etal_2016.PDF
citation.bib
graphics
List_of_theological_demons

I’ll remove that file now

rm List_of_theological_demons