Complete Intro to Linux and the Command-Line
Table of Contents
IntroductionBrian Holt gives an overview of the course, adds that the course focuses mainly on the CLI, and explains why developers need a good understanding of the CLI.
What is UnixBrian gives an overview of the history of the Unix operating system, including its creation at Bell Labs, and adds that the Unix philosophy and guiding principles are still applied today by software engineers.
What is LinuxBrian explains that Linus Torvalds created Linux using the Unix codebase and made Linux free and open source, gives a high level overview of the Linux Kernel, and explains the difference between Linux and Linux distros.
How to Run LinuxBrian describes what virtualization is, and explains how to get Linux running on Windows 10 and macOS operating systems with either VirtualBox or Multipass. Virtualization gives engineers the capability of running multiple operating systems and applications on a single computer or server.
Anatomy of the Command Line InterfaceBrian explains that within a terminal, there is a command line, which has a REPL, or Read Evaluate Print Loop, that allows engineers to only write one line of code at a time. The difference between a shell and an emulator is also discussed in this section.
CLI Directories & ArgumentsBrian demonstrates how to navigate through the different directories within a machine, and explains that arguments or parameters are similar and used to navigate within the CLI.
FlagsBrian demonstrates how to use flags on the command line, and explains that similarly to arguments, flags are information that can are used in CLI commands.
CLI SearchBrian gives an overview of best practices for searching for a command, a program, a directory, the bash history, or a document on the command line.
Bash HistoryBrian continues to explore the command line interface by demonstrating how to find the history of bash commands that have been used. Useful interactions like clearing, copying and pasting, and repeating the last command are also discussed in this section.
CLI ShortcutsBrian demonstrates shortcuts using the CTRL key within the CLI useful for developers every day.
SignalsBrian explains that signals are notifications that are sent to programs from the command line, and gives examples of signals such as CTRL + D -SIG, a signal used in the command line to signal the end of the use of a program. SIGTERM and SIGKILL are also discussed in this section.
nanoBrian gives an overview of text editors already available within the command line, and starts with nano, one of the most common and available options.
VIM: A Brief HistoryBrian gives a brief history of VIM, an editor within the CLI, explains how VIM builds off of previous editors.
VIM: Basic CommandsBrian reviews basic VIM commands, including starting VIM, editing a file, and saving a file. Also covered is how to quit VIM, which is the only command worth remembering, according to Brian.
Files, Pipes, & Permissions
Reading FilesBrian gives an overview of the commands on the CLI that allow developers to read a file, to create one or multiple files, to learn more about a specific program, or to view a snapshot of a given file.
Creating & Moving FilesBrian demonstrates how to create a file from the command line, how to check that the new file was created, how to delete a file, how to rename a file, how to compress a file, and how to delete a folder. Exercising caution when using the delete or 'rm' functionality is also discussed.
Wildcards & ReplacementsBrian explores wildcards, expansions, and replacement, and explains how and why they fixtures in a developer's toolkit.
Output StreamsBrian explains that one of the Linux philosophies is the assumption that the output of a program can be the input to another program through streams and pipes, demonstrates how to redirect the output to another file. This section focuses mainly on 'stdout' and 'stderr'.
Input StreamsBrian explains that stdin (pronounced standard in) is used for input streams using the 'cat' command to input the text of one file into another.
PipesBrian explains that in order to move from one program to another within the command line, developers have to use pipes. A few commands that allow users to remove multiple files or find multiple files with common characteristics are also explored in this segment.
Principle of Least PowerBrian explores the Linux security and permissions model, which is centered around the concepts of users, privileged and unprivileged roles, and the permission model.
SuperuserBrian demonstrates how superuser commands grant access to the root user role, and explains best practice to create other users.
Group PermissionsBrian explores group permissions by changing the ownership of various files, and demonstrates what commands to use for each type of permission change.
Permission ShortcutsBrian gives an overview of a few numbers used to change permissions such as read, write, or execute through the terminal.
Environments & Processes
EnvironmentsBrian explains that environment variables are already set in Bash, and demonstrates how to add new environment variables using .bashrc.
ProcessesBrian defines a process as any sort of command that is currently running, for instance, running bash from the terminal. Interacting with processes is also explained, as well as why they are important.
Exit Codes & Process OperatorsBrian explains how to run a sequence of commands and subcommands as well as exit codes using exit codes, and process operators. Operators allow engineers to run a task once another task has been completed.
SubcommandsBrian explains that when invoking a command within another command, that command is called a subcommand, and runs a few subcommands as examples
Networking & the Internet
SSH & Secondary MachineBrian explains that SSH allows the creation of an intranet, and demonstrates how to create a secondary virtual machine.
Linking two Machines with SSHBrian creates an SSH key in the primary machine and links the secondary machine to the primary machine using a public key. Linking two virtual machines is the simplified version of what various cloud companies offer as a main service.
SFTPBrian explains that it is possible to transfer files using an SFTP connection with an SSH key, and demonstrates how to securely transfer files between a remote machine and a local one.
WgetBrian explains that wget is the network version of cp or copy, adds that wget allows developers to interact with downloads, and that wget allows recursive downloads.
curl BasicsBrian explains that 'curl' is a Linux program that allows developers to test against API servers, starts running an API server locally and uses curl to hit the API endpoint.
curl & HTTP VerbsBrian explores the various HTTP verbs used with 'curl' commands, and demonstrates how to copy a network request. The use of headers and cookies with the curl program is also discussed in this section.
Package Management & APT BasicsBrian gives a brief overview of package management, focuses on the package management tool (APT), and reviews commands.
APT Q&ABrian answers questions from the audience about the different APT commands, namely what are the differences between apt upgrade and apt update.
SnapsBrian explains that snaps are a new format for installing dependencies, and adds that snaps are useful for developers because they are more secure and update automatically.
Writing ScriptsBrian explains that developers can create shell scripts with bash to automate a task, and demonstrates how to create, build, and run a shell script.
HashbangBrian explains that hashbang, prounounced "shabang" is a line that starts with the characters '#'! in a Bash script and that indicates how the bash file should run. For instance, the hashbang can indicate in what language a file should be interpreted. This section also includes a demonstration of how to add a hashbang is a script.
Path & VariablesBrian demonstrates how to create paths to Bash scripts to simplify running scripts through the terminal without having to be in a specific directory. Then, best practices to add variables to a bash script and allow the script to access a variable are outlined.
ArgumentsBrian demonstrates how to pass in the path to a given directory and how to move documents to that directory using arguments.
Conditionals: If Statements & TestsBrian explains that control flows can be used in Bash scripts, and adds that if statements are syntax sugar for tests in bash. In other words, every if statement written in a Bash file is a disguised test.
Conditionals: Else, Else If & Case StatementBrian continues exploring bash script by live coding scripts with 'else' and 'case' statements, and live coding another script that contains case statements. The tools introduced are designed to give viewers the basic tools to write more sophisticated bash scripts
Loops & ArraysBrian continues adding complexity to the bash script started in the previous segment by demonstrating how to use loops and arrays.
Automation & Customization
cronBrian explains that developers use the cron command when a specific job or program needs to be executed following a schedule, and demonstrates how to build a cron job.
Customize Your ShellBrian explains that the prompt is the bit that shows up on every new line, and demonstrate how to customize it.
Colors & Awesome BashBrian continues to demonstrate how to customize the prompt by adding new colors and recommends the use of Awesome Bash to take the prompt customization a step further.