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"
.Rhistory:2:grep -rnwe "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
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"
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"
.Rhistory:2:grep -rnwe "move"
.Rhistory:9:conda_remove(envname = "r-reticulate")
.Rhistory:11:conda_remove("bs4")
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.
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

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-01-12 11:42:49--  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: 77239 (75K) [text/html]
Saving to: ‘List_of_theological_demons’

     0K .......... .......... .......... .......... .......... 66% 1.84M 0s
    50K .......... .......... .....                           100% 9.56M=0.03s

2022-01-12 11:42:49 (2.53 MB/s) - ‘List_of_theological_demons’ saved [77239/77239]
ls
01_basic_bash.Rmd
01_figs
01_git_github.Rmd
01_git_setup.Rmd
List_of_theological_demons
_site.yml

I’ll remove that file now

rm List_of_theological_demons

National Science Foundation Logo American University Logo Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.