Learning Objectives Introducing the Unix shell - UCL/RCPSTrainingMaterials GitHub Wiki
Lesson 1: Introducing the Shell
Questions
- What is a command shell and why would I use one?
Objectives
- Explain how the shell relates to the keyboard, the screen, the operating system, and users’ programs.
- Explain when and why command-line interfaces should be used instead of graphical interfaces.
Lesson 2: Navigating Files and Directories
Questions
- What is a filesystem and how is it organised?
- How can I move around on my computer?
- How can I see what files and directories I have?
- How can I specify the location of a file or directory on my computer?
Objectives
- Display the contents of a directory using the command line.
- Understand the concept of a working directory and know how to identify it.
- Explain the similarities and differences between a file and a directory.
- Translate an absolute path into a relative path and vice versa.
- Construct absolute and relative paths that identify specific files and directories.
- Explain the steps in the shell’s read-run-print cycle.
- Identify the actual command, flags, and filenames in a command-line call.
- Demonstrate the use of tab completion, and explain its advantages
Lesson 3: Working with Files and Directories
Questions
- How can I create, copy, move, and delete files and directories?
- How can I edit files?
- How do I read files?
Objectives
- Create a directory hierarchy that matches a given diagram.
- Create files in that hierarchy using an editor or by copying and renaming existing files.
- Delete specified files and/or directories.
- Know about case sensitivity and why certain characters are best avoided in filenames
- Use wildcards to select multiple files based on their names
- Know some common tools for inspecting file contents
Lesson 4: Pipes and Redirection
Questions
- How do I save the output from a command?
- How can I combine existing commands to do new things?
Objectives
- Redirect a command’s output to a file.
- Process a file instead of keyboard input using redirection.
- Construct command pipelines with two or more stages.
- Explain what usually happens if a program or pipeline isn’t given any input to process.
- Explain Unix’s ‘small pieces, loosely joined’ philosophy.
Lesson 5: Loops
Questions
- How can I perform the same actions on many different files?
Objectives
- Write a loop that applies one or more commands separately to each file in a set of files.
- Trace the values taken on by a loop variable during execution of the loop.
- Explain the difference between a variable’s name and its value.
- Explain why spaces and some punctuation characters shouldn’t be used in file names.
- Save the output from ls to a variable and refer to it in a loop
- Demonstrate how to see what commands have recently been executed.
- Re-run recently executed commands without retyping them.
Lesson 6: Shell Scripts
Questions
- How can I save and re-use commands?
Objectives
- Write a shell script that runs a command or series of commands for a fixed set of files.
- Run a shell script from the command line.
- Write a shell script that operates on a set of files defined by the user on the command line.
- Create pipelines that include shell scripts you, and others, have written.
Lesson 7: Finding Things
Questions
- How can I find files?
- How can I find things in files?
Objectives
- Use grep to select lines from text files that match simple patterns.
- Use find to find files whose names match simple patterns.
- Use the output of one command as the command-line parameters to another command.
- Explain what is meant by ‘text’ and ‘binary’ files, and why many common tools don’t handle the latter well.