Baby Steps in Data Journalism

Starting from zero, this Tumblr provides tools, links and how-to information for people just beginning to explore data journalism.
Posts tagged "start"

As you may have noticed from today’s earlier posts, I’m working with GitHub.

GitHub was easier to get up and running than a lot of Unix/Linux things, thanks to some very nice documentation that doesn’t assume you know everything already.

I started here:

I clicked the picture that says “Set Up Git" (thank you!). Even though the stuff on that page looks intimidating (and long), it all worked properly the first time (hooray!). Don’t forget to record the username(s) and password(s) you choose!

You might need a quick intro to Terminal (Mac OS).

After you work your way through that very long page, the NEXT step is to “Create a Repository.” This is a way of making a new “bucket” on GetHub (and a directory) to hold all your stuff for this one project. You will be able to create other ones for other projects.

Note that if you are using the free version of GitHub (like I am), everything will be PUBLIC. So don’t put any bad things in your repository, okay?

Here I am:

How to edit your .bash_profile file

When I first opened Terminal on my Mac, the prompt was really long. It contained the full name of my Mac, which for some reason I had allowed to be insanely … not great. So I wanted to change the way my prompt looked.

To do this, I edited my user profile on the system.

That profile is controlled by a user’s .bash_profile file. I found a helpful article titled How to Customize your Terminal Prompt and followed the instructions. The article shows you many options.

You start with this (at the command prompt):

nano .bash_profile

You could use nano to open any other text file (just use the filename and path, if necessary, after the word nano).

Anyway, you press Return and thereby go into a simple text editor. If there’s nothing in your .bash_profile file yet, you’ll see your cursor blinking at the top left corner of a blank area. Above that is a bar that says GNU nano and the version number. At the bottom of the screen are some commands, but you might not realize that WriteOut actually means Save (duh).

DO NOT DELETE anything that is already in your .bash_profile file. Move the cursor down below that stuff, on a new line. This is how I changed my command prompt:

export PS1=”\u \W $ “        [NOTE: This is case sensitive.]

So this is my crib sheet for nano on Mac OS:

Save a file: Control-o        [press Return to accept the filename given*]

Exit the file and program: Control-x

That’s all, just two commands.

*After you save, it asks if you want to save that file. I guess it wants you to make sure you’re editing the file that you intended. Press Return at that point, or your file will not be saved.

Baby Steps in Unix/Linux Part 1: Listing

When you’re staring at that bare command prompt in Terminal, of course you don’t know what to do. A command-line interface expects you to type something. But not just anything. It’s not a person, after all. It can’t understand natural language.

So first, try out some useful commands that will show you information about directories (folders) and files that are inside the current directory. Each one is illustrated in one of the images above (CLICK for a slideshow of larger images).

  1. Type ls (for “list”) and press Return (Enter).
  2. Result: The contents of the current directory are listed, in columns.
  3. Type ls -a (“list all”) and press Return (Enter). Result: Now the list includes “hidden” system files, which have names that start with a dot.
  4. Type ls -l (“list long”) and press Return (Enter). Result: Now you see a lot of details about the directory contents, including read/write (rw) permissions.

NOTE: Unix is case sensitive, so pay attention to upper- and lowercase letters.

Starting Python

After you have opened Terminal (or if you are not using a Mac, the equivalent Unix/Linux shell program), type this:


Then press Return (or Enter). You will see the word Python followed by some numbers, as shown above. The numbers tell you which version you are running.

To quit Python, press Control-d. Doing so will return you to the normal command prompt.

To quit Terminal, Command-q (just like every other Mac OS application).

If you have no clue how to work within Terminal (a Unix shell environment is what we call it, I think), this is a good guide. Short! Clear!

Also good:

Terminal - MacRumors: Guides

I wanted to do some of the things recommended in Nathan Yau’s excellent book Visualize This: The FlowingData Guide to Design, Visualization, and Statistics (2011: Wiley). So after I had about 120 lines of notes in a text editing program, I thought: “Hey, with so many links and stuff, I should turn this into a Tumblr!” So here it is.

Click the book cover to see it on

Check out Nathan’s popular blog, FlowingData.