---
title: "01-bash"
format: html
---

# Basic commands and navigation

```{bash}
whoami
```

```{bash}
pwd
```
Personal working directory 

```{bash}
ls
```
Displays contents of current working directory. 

```{bash}
ls -F
```

```{bash}
cd ..
cd ~
ls
cd data-shell
```
Using data-shell tutorial. 

```{bash}
cd ..
cd data-shell
ls
```

```{bash}
cd ..
cd data-shell
ls
ls -F
ls -F data
ls -F /home/jovyan/data-shell/data/
ls north-pacific-gyre/
mkdir thesis
ls -F thesis
```

```{bash}
cd thesis 
nano draft.txt
```
Using nano in R is complicated. The keystrokes to save a file actually prompt R to open a new one. We'll have to find a better approach to generating text files using command line. 

```{bash}
cd ..
ls
cd data-shell
ls
```

```{bash}
cd ..
cd data-shell
ls molecules
cd molecules
wc -l *.pdb
wc -l *.pdb > lengths
sort -n lengths
sort -n lengths > sorted-lengths
head -1 sorted-lengths
sort -n lengths | head -1
wc -l *.pdb | sort -n | head -1
```
wc = word count; sort features, getting a preview of a file via 'head'. 

```{bash}
cd ..
cd data-shell
cd north-pacific-gyre/2012-07-03
wc -l *.txt
wc -l *.txt | sort -n | head -5
wc -l *.txt | sort -n | tail -5
ls *Z.txt
```