# Writing with the command line

Open `iterm`. You can keep it on your dock with a right click on the icon once it's open if you want to have it only a click a way – but using `command`+`space` and typing it is a good way to get use to using your keyboard more.

Speaking of, once you open iterm – I'm just going to call it the terminal from here on out – you can use the arrow keys to move your cursor left or right – or move through the history of your commands by going up and down. You can use `Option` and the left and right keys to jump word by word.

```bash
cd ~/Desktop
touch index.html
```

This moves to your Desktop. Then creates a blank file called `HelloWorld.html`. Now you can add some text to it.

```bash
echo "HelloWorld"
echo "HelloWorld" > index.html
echo "HelloWorld" >> index.html
cat index.html
```

`echo` prints whatever you tell it. The `>` takes that output and overwrites whatever you tell it. The `>>` takes the output and appends it to the target. `cat` prints out a file for you.

# Now let's try using `nano`

That's not an effective way to write a lot of text – or code. Most systems come with a basic text editor called `nano`. Most coders will eventually shift to `vim` or `emacs` but you can depend on nano being there and it's pretty straight forward to use. It's simplicity is helpful.

So let's try using it.

```bash
nano HelloWorld.html
```

Try to delete the extra Hello World line. Now you are using nano... press `control`+`x` to quit and you will be asked if you want to save the changes from this 'buffer' – press `y` for yes and then `enter` to keep the same file name.

Cool.

# and running a server

Now we are going to use `python` to run a server and view the file. This _should_ work with `python` version 2.whatever which _should_ be on your mac.

```bash
python --version
python -m SimpleHTTPServer 8000
```

Now go to your browser of choice and go to `http://localhost:8000` and you should see HelloWorld.

I'd say that's enough for day 2. Next time maybe we will use some HTML, CSS, and Javascript. You read more about python [here](https://www.python.org/about/gettingstarted/) if you want. It's a great language and a lot of people use it to run their server applications, learn programming, and for scientific research.

Press `control`+`c` to stop the server.
