01 April 2015

Command Line Basics

We’re going to use a bunch of command line tools next week.

Looking Better

Before we do more, go ahead and look under Terminal > Preferences and set the default to “Homebrew” – you can fuss with that on your own later if you’d like a different color scheme.

For Starters

The csvkit installation instructions are probably way over your head. If they aren’t, go ahead and install csvkit. If they are (or if you don’t have much command line experience) …

Read the preface, introduction and first chapter of Zed Shaw’s The Command Line Crash Course.

Go ahead and work your way up to Chapter 7. If you get stuck or frustrated, you can post an issue and stop. If you hit a wall or get frustrated, file an issue explaining how you got to where you are and what is frustrating. Keep our guide to asking good questions in mind.

Otherwise … get through to Chapter 7. And then install CSVkit!

Installing CSVkit

So far, we’ve been using built-in shell commands. But I want everyone to do this which pip – if you get a path like /usr/bin/pip that means that pip is on your computer. If you get an error or another command prompt, you must log in to a lab computer and we’ll troubleshoot your computer later.

Then do pip install --user csvkit – if you had admin privs on this machine you could install it everywhere, but the --user flag means you’re only installing it for you.

Installing CSVKit

I wrote a tutorial on installing CSVkit that gives you a bunch of different options. I’ve heard that’s a great place to start.

The csvkit installation instructions tell you to run pip install csvkit. They call that simple. It is simple if you have pip installed and know what it is. But if you don’t, we need to take a few steps back.

csvkit is a python package, pip is a package manager for Python and python, is a programming language. So what you actually need to do is…

First: make sure python is installed.

Start by running which python or python --version – that ought to give you a clue about whether or not you’ve got python running already. Some versions of OSX ship with python pre-installed.

Python-Guide has great instructions for getting started on Windows or OSX.

Jue Yang’s walk through on getting setup is another good place to start.

Second: make sure pip is installed.

If you have python but not homebrew, you’ll start with easy_install pip (or possibly sudo easy_install pip). If you went the homebrew route, brew install pip should do it.

Third: install csvkit.

Now try running pip install csvkit – if you still get an error, it is time to ask for help.





CUNY Graduate School of Journalism

© Spring 2015 Amanda Hickman