Skip to content

@DHRI-Curriculum Session on the command line, a means of interacting with your computer programmatically through text.

License

Notifications You must be signed in to change notification settings

DHRI-Curriculum/command-line

 
 

Repository files navigation

Header image for the Command Line workshop

NOTE: This copy of the curriculum has been archived. To see the most up-to-date version of Command Line, see: Command Line Workshop

If asked to show someone who has never seen a computer how to do something on your computer, many of us would explain what a screen and a cursor are, and then show how to point and click on icons. This approach relies on a graphical user interface, or GUI (pronounced "gooey!"). Today we're going to explore another way to make your computer do things: through the command line. Instead of pointing and clicking, we'll be typing in either git bash (Windows) or terminal (macOS) to tell the computer directly what task we'd like it to perform.

In this workshop, you will:

  • Learn common commands to create files (touch and echo)
  • Learn commands to create directories (mkdir)
  • Navigate our file structure using change directory (cd), print working directory (pwd), and list (ls)
  • Move content from one place to another using redirects (>) and pipes (|)
  • Explore a comma separated values (.csv) dataset using word and line counts, head and tail, and the concatenate command cat
  • Search text files using the grep command
  • Create and sort cheat sheets for the commands we learn

This workshop is estimated to take you 3 hours to complete.

Get Started


Lessons

  1. What Is the Command Line?
  2. Text Editors
  3. Why is the Command Line Useful?
  4. Getting to the Command Line
  5. Prefatory Pro Tips
  6. Navigation
  7. Creating Files and Folders
  8. Creating a Cheat Sheet
  9. Pipes
  10. Exploring Text Data
  11. Interlude
  12. Searching Text Data
  13. What We Have Learned

Before you get started

If you do not have experience or basic knowledge of the following workshops, you may want to look into those before you start with Introduction to the Command Line:

To complete the workshop, you will need:

  • Visual Studio Code (recommended) You can use any plain text editor but for our purposes, Visual Studio Code ("VS Code") will be used.
  • Git Bash (required) If you're using Windows, you will need to follow the instructions to install so that we can work in the cross-platform Unix command line for this session. If you're using macOS, however, you do not need to take any action. The built-in Terminal application has all the functionality we need.
  • Julia Evans's Bite Size Command Line (recommended) Julia Evans's comics explain in detail (while being fun!) some of the most central Unix command line tools. It's a great zine to have on your desk next to you for this workshop, and long after.
  • Basic UNIX commands (recommended) This is another list of commonly used commands in the command line. It's useful, but can be a little overwhelming if you don't have any exposure to these things beforehand. Don't worry, we will cover the most important ones in our Introduction to Command Line workshop!

Ethical Considerations

Before you start the Introduction to the Command Line workshop, we want to remind you of some ethical considerations to take into account when you read through the lessons of this workshop:

  • "The command line" is laden with masculine and military metaphors, which is reflective of the history of computing and programming. As Wendy Hui Kyong Chun discusses in "On Software, or the Persistence of Visual Knowledge" (2004), almost all computers (as in human computers) in the US during World War II were young women. Human computers received commands from analysts—predominantly men with the military—that they then had to interpret and act upon the machine. As Chun (p. 34) argued, "computation depends on 'yes, sir' in response to short declarative sentences and imperatives that are in essence commands ... The command line is a mere operating system (OS) simulation." If commands are the ways in which a user communicates with machines, the command line (of computers today) receives these commands as text that is typed in.

Pre-reading suggestions

Before you start the Introduction to the Command Line workshop, you may want to read a couple of our pre-reading suggestions:

Projects that use these skills

You may also want to check out a couple of projects that use the skills discussed in this workshop:

Mastering the command line will prove useful in a great number of projects. Most Python- and R-based projects will require you to have some knowledge of the command line. At a very basic level, you will be invoking a Python script and will be using values of command line arguments when creating and running your scripts.

  • The command line is useful for setting up installations of server-side software (or more advanced software-as-a-service software, sometimes acronymized as SaaS). Omeka is merely one example. The command line will allow you to navigate the file structure of your server. Commands like ls, mkdir, rmdir, cd, etc. are really important. For example, grep could help you find a plugin directory that you might have accidentally placed in the wrong location.
  • Fair World 64: A Text-Based Game of the 1964–1965 World's Fair A recent digital capstone project by Christofer Gass runs a Python script on the command line
  • Awesome Bash A curated list of useful Bash scripts and resources.

Get Started


Acknowledgements

This workshop is the result of a collaborative effort of a team of people, mostly involved presently or in the past, with the Graduate Center's Digital Initiatives. If you want to see statistics for contributions to this workshop, you can do so here. This is a list of all the contributors:


Digital Research Institute (DRI) Curriculum by Graduate Center Digital Initiatives is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Based on a work at https://github.com/DHRI-Curriculum. When sharing this material or derivative works, preserve this paragraph, changing only the title of the derivative work, or provide comparable attribution.

Creative Commons License

About

@DHRI-Curriculum Session on the command line, a means of interacting with your computer programmatically through text.

Resources

License

Stars

Watchers

Forks

Packages

No packages published