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
  /bin/csh
  /bin/dash
  /bin/ksh
  /bin/sh
  /bin/tcsh
  /bin/zsh

Set Default Shell
  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




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 Mac Ports (https://www.macports.org) -------------------------------------------------------------- Installed MacPorts-2.7.1-12-Monterey.pkg Dec.06, 2021 port help (man page) port installed sudo port -fp uninstall installed sudo port install contacts Dec.06, 2021 sudo port install mtr 0.94 (doesn't use sudo) Dec.06, 2021 sudo port install timeout (works at HE) Dec.06, 2021 sudo port install xv Dec.06, 2021 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) brew brew list -1 brew update brew info blah brew search blah brew install exiftool Dec.06, 2021 brew install fping Dec.06, 2021 brew install hping Dec.06, 2021 brew install lynx Dec.06, 2021 brew install netpbm Dec.06, 2021 brew install speedtest-cli Mar.15, 2022 brew install telnet Dec.06, 2021 brew install timelimit Dec.06, 2021 brew install wget Dec.06, 2021 brew install wifi-password Dec.06, 2021 brew install youtube-dl Dec.06, 2021 brew install pdfgrep Dec.14, 2021 brew install pdftk-java Dec.14, 2021 brew install ffmpeg May.02, 2022 brew install WhatRoute May.27, 2022

SOME USEFUL COMMANDS man last last man set set man setenv setenv man echo man tr echo $PATH | tr ':' '\12' 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 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