Useful CLI Commands

Table of contents
  1. lsbom
  2. networksetup
  3. netstat
  4. ifconfig
  5. system_profiler
  6. fzf (+ Oh-My-Zsh)
    1. Usage example
  7. fasd (+ Oh-My-Zsh)

lsbom

Lists the contents of an installer’s bom (bill of materials) file, which contains information on what files were added to the system.

My preferred usage:

lsbom -f -l -s -pf /var/db/receipts/<some-package-name>.bom >> package-bom.txt

# Inspect manually
vim package-bom.txt

# Then pipe it to some rm code, etc.
# cat package-bom.txt | while read f; do ...; done

networksetup

To see all hardware ports (Wi-Fi, Bluetooth, Thunderbolt, etc.)

networksetup -listallhardwareports

netstat

To see all current in/outbound network connections

netstat -i

ifconfig

To see all network devices on machine

ifconfig

system_profiler

Command line version of the GUI System Profiler on macOS.

To list USB devices,

system_profiler SPUSBDataType

fzf (+ Oh-My-Zsh)

Usage example

vim $(fzf)

fasd (+ Oh-My-Zsh)

To be added