The Shell#


Table of Contents#


Sections#


Resources#

Shells and Terminals

  • [ h ][ g ][ w ] Alacritty

  • [ h ][ g ][ w ] Bash (Bourne-Again Shell)

  • [ h ][ g ][ w ] Bourne Shell (sh)

  • [ h ][ g ][ w ] Cmder

  • [ h ][ g ][ w ] C Shell (csh)

  • [ h ][ g ][ w ] Elvish

  • [ h ][ g ][ w ] Fig

  • [ h ][ g ][ w ] Fish

  • [ h ][ g ][ w ] Fluent

  • [ h ][ g ][ w ] Git for Windows

  • [ h ][ g ][ w ] Hyper

  • [ h ][ g ][ w ] iTerm2

  • [ h ][ g ][ w ] Kitty

  • [ h ][ g ][ w ] Korn Shell (ksh)

  • [ h ][ g ][ w ] Nerd Fonts

  • [ h ][ g ][ w ] Nushell

  • [ h ][ g ][ w ] Oh My Posh

  • [ h ][ g ][ w ] Powerlevel10k

  • [ h ][ g ][ w ] PowerShell

  • [ h ][ g ][ w ] PuTTY

  • [ h ][ g ][ w ] Starship

  • [ h ][ g ][ w ] Tabby

  • [ h ][ g ][ w ] T C Shell (tcsh)

  • [ h ][ g ][ w ] Terminal.app

  • [ h ][ g ][ w ] Terminator

  • [ h ][ g ][ w ] Tilix

  • [ h ][ g ][ w ] Warp

  • [ h ][ g ][ w ] Windows Command Prompt

  • [ h ][ g ][ w ] Windows Terminal

  • [ h ][ g ][ w ] Z Shell (zsh)

Online

  • [ h ] explainshell.com

  • [ h ] Linux Survival

  • [ h ] Google’s Shell Style Guide

  • [ h ] Command Line Environment (MIT’s Missing Semester)

  • [ h ] The Shell (MIT’s Missing Semester)

  • [ h ] Shell Tools and Scripting (MIT’s Missing Semester)

More Online

YouTube#

freeCodeCamp

  • [ y ] 11-09-2022. “Command Line Hacking – Over The Wire Bandit Walkthrough (CTF Wargame)”.

  • [ y ] 11-03-2021. “The 50 Most Popular Linux & Terminal Commands - Full Course for Beginners”.

  • [ y ] 07-25-2018. “Command Line Crash Course”.

Joe Collins

  • [ y ] 01-09-2023 “Let’s Write A Script! | How To Create BASH Scripts In Linux”.

  • [ y ] 09-30-2018 “BASH Environment | Aliases, Functions and Scripts”.

  • [ y ] 08-09-2018 “A Beginner’s Introduction to BASH Shell Scripting”.

  • [ y ] 03-02-2017 “Beginner’s Guide to the Bash Terminal”.

More

  • [ y ] 08-02-2017. CrashCourse. “Keyboards & Command Line Interfaces: Crash Course Computer Science”.

  • [ y ] 08-08-2019. Geek’s Lesson. “Linux Command Line Full course: Beginners to Experts. Bash Command Line Tutorials”.

  • [ y ] 03-15-2022. Learn Linux TV. “Top 5 Terminal Emulators”.

Texts#

  • [ g ] 2022 Albing, Carl & JP Vossen. Bash Idioms: Write Powerful, Flexible, Readable Shell Scripts. O’Reilly.

  • 2012 Barrett, Daniel J. Macintosh Terminal Pocket Guide: Take Command of Your Mac. O’Reilly.

  • 2014 [ h ] Cooper, Mendel. Advanced Bash-Scripting Guide: An in-depth exploration of the art of shell scripting.

  • 2008 [ h ] Garrels, Machtelt. Bash Guide for Beginners.

  • 2021 Janssens, Jeroen. Data Science at the Command Line: Obtain, Scrub, Explore, and Model Data with Unix Power Tools. 2e. O’Reilly.

  • [ g ] 2002 Powers, Shelley et al. Unix Power Tools. 3e. O’Reilly.

  • [ g ] 2005 Robbins, Arnold & Nelson H. F. Beebe. Classic Shell Scripting. O’Reilly.

  • 2016 Taylor, Dave & Brandon Perry. Wicked Cool Shell Scripts: 101 Scripts for Linux, OS X, and Unix Systems. 2e. No Starch Press.

Terms#

  • [ w ] Autocompletion

  • [ w ] Command Line

  • [ w ] Command Line Interface (CLI)

  • [ w ] Glob

  • [ w ] Globbing

  • [ w ] Interpreter Directive

  • [ w ] Pattern Calculus

  • [ w ] Pattern Matching

  • [ w ] POSIX Shell

  • [ w ] Shebang

  • [ w ] Shell

  • [ w ] Shell Builtin

  • [ w ] Shells

  • [ w ] Snippet

  • [ w ] Terminal Emulator

  • [ w ] Terminal.app

  • [ w ] Wildcard Character

  • [ w ] Wildcard Matching

  • [ w ] Windows Command Prompt

  • [ w ] Windows Console

  • [ w ] Windows Terminal


Intro#

cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/pwsh

All shells have startup files containing commands which are executed as soon as the shell starts.

The shell is there to take a list of commands and run them; it doesn’t care whether the commands are in a file or typed at the terminal. When you type a command and wait for it to run before typing another, the shell is interactive. When the shell reads commands from a file, the shell is non-interactive. A shell is interactive if it has a prompt. A list of commands in a file is called a script (as if the shell were acting in a play when it reads from it). The interactive shell waits in the background for a non-interactive copy to read a script.

Builtins and functions run as a part of the shell itself and are therefore more efficient than things like external commands (that don’t run in the shell and which can’t affect its parameters, functions, aliases, etc.).