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 "Terminal"

Computer Hope has a nicely formatted reference for Unix/Linux commands, clear and easy to understand, responds well to searches. 

Where am I when I open Terminal?

That’s where. Look at the image. See the little house? That’s you.

Of course, you’re not mmcadams. That’s me!

SEE ALSO: Baby Steps in Unix/Linux Part 2: Change Directories

When you’re using Terminal, you can open plain-text files using the nano command:

nano [path/filename]

nano is a small, free and friendly editor which aims to replace Pico, the default editor included in the non-free Pine package. Rather than just copying Pico’s look and feel, nano also implements some missing (or disabled by default) features in Pico, such as ‘search and replace’ and ‘go to line and column number’” (from the manual).

SEE ALSO: The GNU nano homepage

Baby Steps in Unix/Linux Part 3: Your Home Directory

What if you get lost after you have changed to different directories too many times?

There’s no place like home — here’s how to click your heels and get back.

Type the following and then press Return (or Enter):


That’s it, just cd by itself. That will take you back you your own home directory on the system. However, if you want to go outside that directory, to the root of the system, type the following and then press Return (or Enter):

cd /

That is cd, and one space, and a slash.

A brief introduction to some useful commands in Unix or Linux. Alphabetical listing. More than you will probably need, but not too much, and you don’t have to click out to read what the command does. No ads (hooray!). From Indiana University.

Baby Steps in Unix/Linux Part 2: Change Directories

One of the common tasks you’ll be doing in Terminal is changing directories. What Unix calls “directories” are the same as what most of us call “folders” on our computers.

Experiment with the cd (“change directory”) command to find out how it works.

Use the ls (“list”) command to see the names of directories that are inside the current one. You will probably see one named Desktop, so let’s peek inside that one. Type the following and then press Return (or Enter):

cd Desktop

Remember that Unix is case sensitive, so pay attention to that uppercase letter “D” in Desktop.

To see what’s inside Desktop (“list” the contents), type the following and then press Return (or Enter):


You should see the names of all the stuff that’s on your Mac Desktop.

To go back “up” to the parent directory (the one you started in, in this case, and which contains the folder named Desktop), type the following and then press Return (or Enter):

cd ..


Finally, what if you want to change to a folder that’s easy to locate in the Finder, but you don’t want to type all the many folder names leading down, down, down to where it is buried? Easy peasy: Just find the folder the normal way, using the Mac Finder — then click it once (don’t open it) and then press Command-c to copy the “path.”

Return to your Terminal window. Type cd and one space, and then paste (Command-v). Press Return, and bingo! You’re in that directory, no matter how deep down it is.

Each of these steps is illustrated in one of the images above (CLICK for a slideshow of larger images).

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

How to Open Terminal and Change Its Appearance

Many Mac users have never used Terminal. You will be using this when you work with Python. It will be nicer for you if you change Terminal to look better, according to your preferences for color and so on.


Open Spotlight and type:  terminal

Open Terminal by clicking it in the Spotlight menu.

To change settings, Terminal menu > Preferences.

Click the Settings tab (see image above).

  1. Select a color scheme from the left column.
  2. Select a bigger font size so you don’t go blind.
  3. Click the Default button at lower left.
  4. Close Preferences.
  5. Quit Terminal, and then re-open Terminal.

Your new colors and fonts will be in effect.

NOTE: Do not change the font to a proportional font. Use a monospace font, such as Andale Mono (the default).