Introduction to Command Line

Session Overview

  • What is Bash?
  • Navigating your Environment
  • Manipulating your Environment
  • Command Line Text Editors

Bash

The Bourne Again Shell…

Shell:

  • Command processor where user types commands to control computer

  • Exposes operating system via a Command-Line Interface (CLI)

  • Many shells; Bash is default for this course

Bash, but Why?

  • Rich interface to programming tools
  • Scriptable
  • Reproducibility
  • Faster

Let’s Play!

  • Log Into Course Platform https://esds.ncics.org/

  • Select Create Workspace.

  • Select ESDS EC2 Instance.

  • Workspace Name: module-1-your-initials

  • Keep Defaults:

    • 2 vCPUs, 1GiB RAM
    • US East (N. Virginia)
  • Select Create Workspace

Wait a bit until it is created.

  • Select Terminal.

This will open in a new window.

Manipulating your Environment

  • Creating directory: mkdir esds_test
  • Creating files: touch myfile.txt
  • Filling files: echo "Hello World" > hello.txt
  • Print files: cat hello.txt
  • Copying files: cp hello.txt hello2.txt
  • Renaming/Moving files: mv hello2.txt moved-hello.txt

Command Line Text Editors

Many, but we will use Vim in this class.

  • Launching Vim
  • Vim Modes: Normal, Insert, Visual
  • Navigating
  • Saving files
  • Exiting

Exercise

  1. Make two new directories
  2. Create a text file in one directory, then move it to another.
  3. Add your name in the file using vim. Make sure you save it! :)

Additional Resources