Substack
Course Description
In this course James Halliday (Substack), author with more than 750 packages at npm, walks you through an illuminating guide to everything Unix! You'll learn how to take control of the Unix command line to write your own tools, automate tasks with shell scripts and the pipeline, compose regular expressions to master search patterns, and easily edit files with the popular Vim editor.
This course and others like it are available as part of our Frontend Masters video subscription.
Preview
CloseCourse Details
Published: August 16, 2017
Learn Straight from the Experts Who Shape the Modern Web
Your Path to Senior Developer and Beyond
- 200+ In-depth courses
- 18 Learning Paths
- Industry Leading Experts
- Live Interactive Workshops
Table of Contents
Bash
Section Duration: 27 minutes
- James Halliday introduces Bash by placing its context with the history and background of Unix, an operating system first developed at AT&T Bell Labs in the 1960s.
- James presents the Unix shell, a computer program that executes other computer programs, and its importance with the UNIX philosophy.
- After prompting students to open a terminal window and figuring out which shell they have installed on their computers, James demonstrates how to navigate through folders and files in an operating system through the terminal.
- While students work on changing directories, James spends some moments demonstrating and writing temporary aliases. An alias is a stand-in or replacement of a word by another string mainly used for abbreviating a system command.
- James demonstrates special directories within the Bash shell that make it easier to navigate folders.
File Management
Section Duration: 36 minutes
- James introduces to commands for files: The cat command, which concatenates many files into one file, and cp command, which can copy a file to another directory or file name.
- To move files, James introduces the mv command. Afterward, James shows how to create a director with mkdir command and how to use tab to auto-complete directories.
- After showing the wildcard character to matching files, James demonstrates how to use brace expansions, which allow for expanding patterns that would be repetitive to type out by hand.
- James introduces the rm command file to remove files and directories. Then James shows how to use the wc command to count the number of lines, words, and bytes in a file.
- To find the documentation at any time, James shows the man command that lists the commands that are available in the shell. Afterward, he demonstrates that options also called flags or switches, which are special arguments that can be passed onto shell command.
- James demonstrates how to navigate to a file with absolute and relative paths.
- James introduces file redirects. Redirects can write the output of a command to a file, overwrite a file with new contents if it already exists.
Pipes
Section Duration: 48 minutes
- James shows the pipe operator, which can feed the output of one program to the input of the next.
- James demonstrates the curl command, which grabs data from or to a server using many protocols like HTTP or FTP. Using the curl command to grab a public domain text, James then shows how to chains commands until he figures out the number of types the word "whale" is used in Moby Dick.
- James reviews the head and tail commands. Head command prints the first part of a file while the tail command reads from the end of the file.
- James shows how to print out the date with date command as well as showing the month or year with the cal command.
- James demonstrates the fold command, which is used to shorten long lines.
- James reviews in more detail curl and grep.
- James shows how to use backticks, which allow the output of a program in the arguments list of another. Then James illustrates how to do simple arithmetic at the command line.
- James takes questions from students about the watch and the calendar commands.
- James introduces environment variables, what are variables defined by the shell and shell scripts.
- To escape special characters from an argument, James introduces the use of quotes.
Bash Shell Scripts
Section Duration: 55 minutes
- To keep from writing the same sequence of commands repeatedly, James shows how to write and store a script that can be executed.
- James demonstrates the read command, which takes input from the keyboard and assigns it to a variable. After that, James covers loops that run a set of commands repeatedly. Then James expands upon the loop to show the while loop, execute a set of commands repeatedly until some condition occurs.
- James introduces the special environment variable $PATH
- James explains that files on a UNIX system belong to a user or a group. Each group can have granular permission to write, edit, or view a file. Those permissions can be changed using the chmod command.
- James illustrates an exit code, which is a code returned to a parent process by an executable. If the code is successful, the exit code is 0. Next James demonstrates the &&, ||, and ; operators. Then James demonstrates a subshell, which is a subprocess or child process of the parent shell.
- James examples job control as a method Bash handling multiple programs running in parallel. James takes questions from students.
- James introduces screen, which allows multiple virtual windows in Unix.
Regular Expressions
Section Duration: 53 minutes
- James introduces Regular Expressions (regex or regexp), which is special text string for describing a search pattern or a search and replace command.
- James demonstrates how to use Regular Expressions in JavaScript.
- James shows how to gain finer control over searches with Regular Expressions through the use of flags, metacharacters, and quantifiers.
- James introduces characters classes, which commands Regular Expressions to match several sets of characters
- To have a search pattern check at the start of the beginning of a string, James shows anchoring within Regular Expressions. Then James demonstrates capture groups, which allow for targeting a number of letters or numbers. Next James introduces sed, a stream editor used to perform basic text transformations.
- James shows the Perl Regular Expressions Reference as a useful tool that is probably already installed on your OS for researching syntaxes for Regular Expression. James takes questions from students.
- James wraps up Regular Expressions with some advice on how to keep on learning.
Vim
Section Duration: 38 minutes
- James introduces Vim, an interactive text editor program for Unix that is popular for its rich features and as a development environment. The Vim editor supports ANSI codes that are special instructions that your terminal interprets and renders like moving the cursor around, change colors, or set editing modes.
- James shows how to use Vim to open, edit, and quit files.
- James demonstrates how to move within a document while editing within the Vim editor.
- After showing how to delete files, James demonstrates how to search within in a document with Regular Expressions. James takes questions from students.
- James demonstrates search and replace with Regular Expressions.
- James introduces visual mode, which is a flexible and easy mode to select a piece of text for an operator.
- Within visual mode, James introduces the paste buffer, which allows for copy and pasting. Then James introduces insert modes for finer control over the opening of files.
- While wrapping up the course, James shows some tricks with Vim including inserting a file into another file; pipe commands within the editor; and remap characters for better editing experience.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops