Apple Resources - Command Line Tools
http://edu-observatory.org/olli/Apple_Resources/Command_Line_Tools.html



How To Use The Mac Terminal: The Basics
  https://appletoolbox.com/use-the-mac-terminal-the-basics/   

  The Mac terminal is the built-in shell environment on Mac
  that allows you to directly issue UNIX commands. That's the
  technical definition, anyway.

  In simpler terms, you can think of it as an app that gives
  you access to a deeper level of your Mac's operating system.
  Kind of like lifting the hood of your car and poking around
  the engine, but for your Mac's software.

  The Mac terminal is not a way to "hack" your computer, and
  it generally isn't going to break your computer. When I was
  first learning how the terminal worked, I remember worrying
  that I was going to enter the wrong command and completely
  brick my Mac.

  But Apple doesn't give you this kind of power easily. You
  can technically ruin your Mac by entering certain commands
  into the terminal (make sure you copy trusted commands from
  the internet on sites like StackExchange) but it's unlikely
  that you'll run into these commands during daily use.

  In short: The Mac terminal is an app that gives you greater
  control over your Mac, but has a learning curve and the
  occasional risk. That said, it's far from dangerous to
  experiment with.


Terminal User Guide
  https://support.apple.com/guide/terminal/welcome/mac   
  https://support.apple.com/guide/terminal/execute-commands-and-run-tools-apdb66b5242-0d18-49fc-9c47-a2498b7c91d5/mac   
  http://www.cheat-sheets.org/saved-copy/2084227-Mac-OS-X-Terminal-Commands-list.pdf   
  https://ss64.com/osx/   


Command Line Tools -- Install
  xcode-select --install

List Available Shells
  cat /etc/shells

  /bin/bash  (older Apple default)
  /bin/csh
  /bin/dash
  /bin/ksh
  /bin/sh
  /bin/tcsh  (author's favorite)
  /bin/zsh   (Newer Apple default)

Set Default Shell Example
  chsh -s /bin/tcsh

Shell Scripting Primer
  https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/shell_scripts/shell_scripts.html   

Man[ual] Pages
  man
  man -k say
  man say

Terminal > Help > Search




Change macOS user preferences via command line https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/AboutPreferenceDomains/AboutPreferenceDomains.html https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/ The System Preferences window is not the only way to adjust user settings. Macs come with a defaults command line interface that lets you read, write, and delete macOS user defaults. defaults write com.apple.Dock autohide-delay -float 0; killall Dock defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'; killall Dock defaults write com.apple.finder AppleShowAllFiles -bool TRUE defaults write com.apple.finder QLEnableTextSelection -bool TRUE defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2MinimumFontSize -int 19 defaults write com.apple.screencapture disable-shadow -bool TRUE defaults write com.apple.screencapture location ~/Downloads defaults write com.apple.Terminal FocusFollowsMouse -bool true defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool FALSE defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true defaults write -g NSRequiresAquaSystemAppearance -bool Yes

Software Package Managers Home Brew (https://brew.sh) -------------------------------------------------------------- Installed Homebrew 3.3.7 Dec.06, 2021 Homebrew Installation bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" note: need to add /opt/homebrew/bin to PATH set path = (/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin /usr/local/lib /usr/lib /Developer/Tools /opt/X11/bin /opt/local/bin /opt/local/sbin /opt/homebrew/bin ~/bin) set path = (\ /bin \ /sbin \ /usr/bin \ /usr/sbin \ /usr/local/bin \ /usr/local/sbin \ /usr/local/lib \ /usr/lib \ /Developer/Tools \ /opt/X11/bin \ /opt/local/bin \ /opt/local/sbin \ /opt/homebrew/bin\ ~/bin) Example usage: brew search TEXT|/REGEX/ brew info [FORMULA|CASK...] brew install FORMULA|CASK... brew update brew upgrade [FORMULA|CASK...] brew uninstall FORMULA|CASK... brew list [FORMULA|CASK...] -1 Troubleshooting: brew config brew doctor brew install --verbose --debug FORMULA|CASK Contributing: brew create URL [--no-fetch] brew edit [FORMULA|CASK...] Further help: brew commands brew help [COMMAND] man brew open https://docs.brew.sh Some of this author's installations brew install exiftool brew install fping brew install hping brew install lynx brew install netpbm brew install speedtest-cli brew install telnet brew install timelimit brew install wget brew install wifi-password brew install youtube-dl brew install pdfgrep brew install pdftk-java brew install ffmpeg brew install WhatRoute brew install diff-pdf Some Casks from Patric Wardle's Objective-See brew install blockblock brew install kextviewr brew install knockknock brew install lulu brew install netiquette brew install oversight brew install ransomwhere brew install taskexplorer Cask for ChatGPT brew install vincelwt-chatgpt

SOME USEFUL COMMANDS man last last man set set man setenv setenv man echo man tr echo $PATH | tr ':' '\12' Astronomy Picture of the Day (APOD) open https://apod.nasa.gov/apod/ap`date +%y%m%d`.html Download the METAR data from the Ames Airport man lynx man head lynx -dump 'https://www.aviationweather.gov/adds/metars/?station_ids=KAMW&std_trans=translated&chk_metars=on' | head -16 Network Interface man ifconfig ifconfig man grep man cut ifconfig `route get default | grep interface | cut -c14-17` Network Interface Quality man networkQuality networkQuality Who is on my Local Area Network (LAN) man arp arp -an | grep : man snmptable snmptable -v 2c -c public `netstat -rn | grep "default" | head -1 | cut -c20-33` ipNetToMedia man fping fping -aeg `ifconfig -l | xargs -n1 ipconfig getifaddr`/24 Internet Connections man lsof lsof -nPi Check my connection to Apple (to quit type q) man mtr mtr --aslookup --show-ips apple.com mtr --aslookup --show-ips 17.253.144.10 mtr --aslookup --show-ips 2620:149:bb:9420::151 Example of downloading a YouTube Video/Audio youtube-dl youtube-dl https://www.youtube.com/watch\?v=VLPP3XmYxXg youtube-dl --extract-audio --audio-format mp3 https://www.youtube.com/watch\?v=VLPP3XmYxXg Note: I have to insert the "back slash" in front of the "?" in the URL, so that it will not be treated as a special character. Perhaps you just want to listen first. open -a Safari https://www.youtube.com/watch\?v=VLPP3XmYxXg

BOOK RECOMMENDATION Top 5 Shell Scripting Books for Beginners in 2022 https://booksoncode.com/articles/best-shell-scripting-books-for-beginners Take Control of the Mac Command Line with Terminal, Third Edition Copyright 2022, Joe Kissell. All rights reserved. ISBN for EPUB and Mobi version: 978-1-990783-03-6 https://books.apple.com/us/book/take-control-of-the-mac-command-line-with/id1619578790 “Welcome to Take Control of the Mac Command Line with Terminal, Third Edition, version 3.2, published in April 2022 by alt concepts. This book was written by Joe Kissell and edited by Geoff Duncan. This book introduces you to the macOS command line environment, teaching you how to use the Terminal utility to accomplish useful, interesting tasks that are either difficult or impossible to perform in the graphical interface. Most of the examples work with 10.6 Snow Leopard and later, although a few techniques require more recent versions of macOS.” Classic Shell Scripting 1st Edition by Arnold Robbins V (Author), Nelson H.F. Beebe V (Author) https://www.amazon.com/Classic-Shell-Scripting-Arnold-Robbins/dp/0596005954/ref=sr_1_4?keywords=shell+scripting&qid=1654727514&sr=8-4 Shell scripting skills never go out of style. It's the shell that unlocks the real potential of Unix. Shell scripting is essential for Unix users and system administrators-a way to quickly harness and customize the full power of any Unix system. With shell scripts, you can combine the fundamental Unix text and file processing commands to crunch data and automate repetitive tasks. But beneath this simple promise lies a treacherous ocean of variations in Unix commands and standards. Classic Shell Scripting is written to help you reliably navigate these tricky waters. Writing shell scripts requires more than just a knowledge of the shell language, it also requires familiarity with the individual Unix programs: why each one is there, how to use them by themselves, and in combination with the other programs. The authors are intimately familiar with the tips and tricks that can be used to create excellent scripts, as well as the traps that can make your best effort a bad shell script. With Classic Shell Scripting you'll avoid hours of wasted effort. You'll learn not only write useful shell scripts, but how to do it properly and portably. The ability to program and customize the shell quickly, reliably, and portably to get the best out of any individual system is an important skill for anyone operating and maintaining Unix or Linux systems. Classic Shell Scripting gives you everything you need to master these essential skills. sam.wormley@gmail.com