Get AI summaries of any video or article — Sign up free
50 macOS Tips and Tricks Using Terminal (the last one is CRAZY!) thumbnail

50 macOS Tips and Tricks Using Terminal (the last one is CRAZY!)

NetworkChuck·
5 min read

Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.

TL;DR

Terminal can make macOS speak with `say`, and it can copy command output to the clipboard using `| pbcopy` for fast sharing.

Briefing

A fast tour of macOS Terminal commands turns everyday Mac tasks—speech, screenshots, Wi‑Fi password retrieval, file management, networking diagnostics, and system monitoring—into one-liners, then escalates into “installable” Terminal toys via Homebrew. The practical through-line is simple: most useful Mac workflows can be automated or accelerated from the command line, and many can be made more convenient (clipboard copying, plain-text pasting, custom screenshot naming, and even Touch ID for sudo).

Early commands focus on quick wins. Terminal can make the Mac speak using `say`, and it can reveal saved Wi‑Fi credentials by querying the system keychain with `security find-generic-password -w -a <network name>`. For sharing, output can be copied straight to the clipboard using `| pbcopy`, which pipes any command’s results into the clipboard. The transcript also highlights productivity shortcuts: plain-text pasting with `pbpaste`/`pbcopy`-style workflows (via `Shift`+`Command`+`V`), keeping the Mac awake with `caffeinate`, and capturing screenshots with `Command`+`Shift`+`3` (whole screen) or `Command`+`Shift`+`4` (selection). Screenshot behavior can be customized by changing defaults for filename, file type (e.g., JPEG), and save location using `defaults write com.apple.screencapture ...`.

Beyond convenience, the command set digs into visibility and control. macOS keeps a download history in a SQLite database, retrievable with a command that queries the relevant `com.apple.LaunchServices` database; clearing browser history doesn’t necessarily erase what’s stored there. Password changes can be handled without leaving Terminal using `passwd`, and the transcript emphasizes using unique passwords per service. That’s where Dashlane enters as a sponsor: it manages passwords, monitors password health (including compromised credentials via dark web monitoring), supports password sharing, and includes built-in two-factor authentication.

A large middle section speeds through Unix-style fundamentals that carry over from Linux: `cd`, `ls`, `pwd`, `whoami`, `mv`, `cp` (and macOS’s `ditto`), `df -h` for disk space, `nano` for editing, `man` for command help, and `open` to launch files like screenshots. Networking commands add troubleshooting muscle: `ping` to test reachability, `ifconfig` (and a more targeted `ifconfig en0` approach) to find IP addresses, `grep`-filtered interface output to extract IPv4/IPv6 addresses, `traceroute` to map router hops and latency, and `dig` to inspect DNS records. Process management is covered with `ps`, `ps -ax`, `top` (including memory-focused sorting), and `kill -9 <PID>` after locating a process ID.

The final stretch turns Terminal into a playground. It checks the active shell with `which $SHELL`, switches between `zsh` and `bash`, reports uptime with `uptime`, and flushes DNS cache using `sudo`-prefixed commands. File and web utilities appear via `qlmanage -p` (Quick Look preview), `diff` (file comparison), and `curl` (downloads and even a weather example). There’s also a built-in “leave” alarm, command history via `history`, and a Gatekeeper toggle using `sudo spctl --master-disable` (with a warning not to do it casually).

The most dramatic segment depends on Homebrew: after installing it, the transcript installs Terminal-native “apps” like `cmatrix` (the red “Matrix” effect), `asciiquarium` (animated ASCII fish), `toilet` (ASCII art text), and `tetris` (playable in the terminal). It also shows a quick Python web server (`python3 -m http.server`) and power controls (`shutdown -h now` / `shutdown -r now`). The capstone is security convenience: editing `/etc/pam.d/sudo` to allow Touch ID (`pam_tid`) so sudo prompts can use fingerprint instead of typing a password—framed as the “best command ever” for anyone tired of repeated sudo entries.

Cornell Notes

The transcript assembles a practical “command-line toolkit” for macOS: quick automation (speech with `say`, clipboard piping with `pbcopy`, keeping the Mac awake with `caffeinate`), faster workflows (plain-text pasting, screenshot capture and customization via `defaults write com.apple.screencapture`), and deeper system access (Wi‑Fi password retrieval through `security`, download history via a SQLite database, and password changes via `passwd`). It then shifts to Unix fundamentals and networking diagnostics—`ping`, `ifconfig`, `grep`, `traceroute`, `dig`—plus process management with `ps`, `top`, and `kill -9`. The final section uses Homebrew to install Terminal “apps” like `cmatrix`, `asciiquarium`, `toilet`, and `tetris`, and finishes with a Touch ID sudo setup by editing `/etc/pam.d/sudo`.

How can Terminal copy the output of another command directly to the clipboard?

Use piping into `pbcopy`. The transcript demonstrates retrieving a Wi‑Fi password with a `security find-generic-password ... -w ...` command, then copying that output by running the same command again but appending `| pbcopy`. This pattern works with many commands: `some command | pbcopy` places the command’s stdout into the clipboard for immediate pasting.

What commands are used to capture screenshots, and how can the default screenshot filename/type/location be changed?

Screenshots use macOS shortcuts: `Command`+`Shift`+`3` captures the whole screen, while `Command`+`Shift`+`4` lets the user select a region. For customization, the transcript uses `defaults write com.apple.screencapture ...` to set capture name, file type (e.g., JPEG), and save location. After changing these defaults, subsequent captures follow the new naming and storage rules.

How does the transcript find saved Wi‑Fi passwords from Terminal?

It uses the macOS keychain via the `security` command: `security find-generic-password -w -a <wifi network name>`. The `-w` flag outputs the password, and `-a` specifies the account/network name. The result can then be copied with `| pbcopy` if needed.

Which networking tools help diagnose connectivity, routing, and DNS issues?

For reachability, it uses `ping <website>`. For IP addressing, it starts with `ifconfig` and then suggests `ifconfig en0` for a cleaner result, using `grep` in a pipeline to extract IPv4 and IPv6 addresses. To map the path through the internet, it uses `traceroute <website>` to show each hop and latency. To inspect DNS records, it uses `dig <website>`.

How are processes inspected and terminated from Terminal?

It uses `ps` for process listings, `ps -ax` for more complete output, and `top` for real-time monitoring (including sorting/filtering by CPU and memory, such as `top -o rsize`). To stop a process, it identifies the process ID (PID) and then runs `kill -9 <PID>`.

What’s the “Terminal playground” workflow, and what are examples of installed tools?

The transcript installs Homebrew first (described as the missing package manager for macOS). After Homebrew is ready, it installs Terminal programs with `brew install ...` and runs them directly. Examples include `cmatrix` (Matrix-style animation), `asciiquarium` (ASCII fish animation), `toilet` (ASCII art text), and `tetris` (playable in the terminal).

Review Questions

  1. Which command-line pattern lets you pipe command output into the clipboard, and what’s a concrete example from the transcript?
  2. How do `ping`, `traceroute`, and `dig` each contribute to troubleshooting a website problem?
  3. What steps are involved in enabling Touch ID for sudo by editing `/etc/pam.d/sudo`, and why does it reduce repeated password prompts?

Key Points

  1. 1

    Terminal can make macOS speak with `say`, and it can copy command output to the clipboard using `| pbcopy` for fast sharing.

  2. 2

    Saved Wi‑Fi passwords can be retrieved via the keychain using `security find-generic-password -w -a <network name>`, then copied with `pbcopy` if desired.

  3. 3

    Screenshot capture can be customized using `defaults write com.apple.screencapture` to change filename, file type, and save location.

  4. 4

    Networking troubleshooting is streamlined with `ping`, `ifconfig` (plus `grep` filtering), `traceroute`, and `dig` for DNS records.

  5. 5

    Process visibility and control come from `ps`, `top`, and `kill -9 <PID>` after locating the correct PID.

  6. 6

    Homebrew enables Terminal “apps” like `cmatrix`, `asciiquarium`, `toilet`, and `tetris` through `brew install` commands.

  7. 7

    Touch ID can replace repeated sudo password entry by editing `/etc/pam.d/sudo` to add the `pam_tid` line.

Highlights

`security find-generic-password -w -a <wifi name>` can surface stored Wi‑Fi passwords, and `| pbcopy` can move that output straight into the clipboard.
`defaults write com.apple.screencapture` lets screenshot naming, file type (like JPEG), and save location be changed without leaving Terminal.
Homebrew turns Terminal from a utility into a platform—installing `cmatrix`, `asciiquarium`, `toilet`, and `tetris` in minutes.
Editing `/etc/pam.d/sudo` to add `pam_tid` is presented as a major quality-of-life upgrade: sudo prompts can use Touch ID instead of typing a password.

Topics

  • Terminal Basics
  • macOS Keychain
  • Screenshot Customization
  • Networking Diagnostics
  • Homebrew Installs
  • Process Management
  • sudo Touch ID

Mentioned