Learning Outcomes

What is a command shell and why would I use one?

To answer this question you will learn to:

  1. Explain how the shell relates to the keyboard, screen, operating system and users’ programs.

  2. Explain when and why command-line interfaces should be used instead of graphical interfaces.

Referencing modules: Introducing the Shell

What is a file system and how do I use one?

To answer this question you will learn to:

  1. Display the contents of a directory using the command line.

  2. Understand the concept of a working directory and know how to identify it.

  3. Explain the similarities and differences between a file and directory.

  4. Translate an absolute path into a relative path and vice-versa.

  5. Construct absolute and relative paths that identify specific files and directories.

  6. Explain the steps in the shell’s read-run-print cycle.

  7. Identify the actual command, flags, and filenames in a command-line call.

  8. Demonstrate the use of tab completion and explain its advantages.

Referencing modules: Navigating Files and Directories

How do I manage my files and directories?

To answer this question you will learn to:

  1. Create a directory hierarchy that matches a given diagram.

  2. Create files in that hierarchy by using an editor or by copying and renaming existing files.

  3. Delete specified files and/or directories.

  4. Know about case sensitivity and why certain characters are best avoided in filenames.

  5. Use wildcards to select multiple files based on their names.

  6. Know and use some common tools for inspecting file contents.

Referencing modules: Working with Files and Directories

How can I combine existing commands to do new things?

To answer this question you will learn to:

  1. Redirect a command’s output to a file.

  2. Process a file instead of keyboard input using redirection.

  3. Construct command pipelines with two or more stages.

  4. Explain what usually happens if a program or pipeline isn’t given any input to process.

  5. Explain Unix’s ‘small pieces, loosely joined’ philosophy.

Referencing modules: Pipes and Redirection

How can I find files and things in files?

To answer this question you will learn to:

  1. Use grep to select lines from text files that match simple patterns.

  2. Use find to find files whose names match simple patterns.

  3. Use the output of one command as the command-line parameters to another command.

  4. Explain what is meant by ‘text’ and ‘binary’ files, and why many common tools don’t handle the latter well.

Referencing modules: Finding Things

How can I perform the same actions on many different files?

To answer this question you will learn to:

  1. Write a loop that applies one or more commands separately to each file in a set of files.

  2. Trace the values taken on by a loop variable during execution of the loop.

  3. Explain the difference between a variable’s name and its value.

  4. Explain why spaces and some punctuation characters shouldn’t be used in filenames.

  5. Save the output from ls to a variable and refer to it in a loop.

  6. Demonstrate how to see what commands have recently been executed.

  7. Re-run recently executed commands without re-typing them.

Referencing modules: Loops

How can I save and re-use commands?

To answer this question you will learn to:

  1. Write a shell script that runs a command or series of commands for a fixed set of files.

  2. Run a shell script from the command line.

  3. Write a shell script that operates on a set of files defined by the user on the command line.

  4. Create pipelines that include shell scripts you, and others, have written.

Referencing modules: Shell Scripts