跳到主要内容

macOS

macOS

Who is listening on a given TCP port on Mac OS X?

sudo lsof -i -n -P | grep LISTEN
netstat -an -ptcp | grep LISTEN
sudo lsof -iTCP -sTCP:LISTEN -P -n

如果你想(强迫症般地)准确输入左引号和右引号,在 macOS 上可以使用这些快捷键:

左弯双引号 “:Option-[
右弯双引号 ”:Option-Shift-[
左弯单引号 ‘:Option-]
右弯单引号 ’:Option-Shift-]
左直角引号 「:中文输入法,Shift-[
右直角引号 」:中文输入法,Shift-]

自然码:

defaults write com.apple.inputmethod.CoreChineseEngineFramework shuangpinLayout 5

Repeat

defaults write -g ApplePressAndHoldEnabled -bool false

cloak

launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/cloak.macos.plist

Flushing your DNS cache on Mac OS X

sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

Show listen ports

lsof -nP -iTCP | grep LISTEN

Bluetooth Devices Not Connecting to OSX

Solution:

  1. Delete com.apple.Bluetooth.plist. This file is found at HD/Library/Preferences.
  2. Turn off Bluetooth on your Mac. This is done by clicking the Bluetooth icon in the menu bar and selecting ‘Turn Bluetooth Off’.
  3. Unplug input-based USB devices (e.g. any USB mice, keyboards, Wacom tablets, etc).
  4. Shut down computer. Do not restart, but do a full shut down.
  5. Turn off your Bluetooth devices.
  6. Boot computer.
  7. Turn Bluetooth on.
  8. Begin pairing devices. This involves clicking: Bluetooth icon in menu bar >> Set up Bluetooth Device >> Select Bluetooth device >> Follow on-screen instructions. In the case of your keyboard, I would suggest pressing the ‘Enter/Return’ button several times after entering the passphrase shown on your screen.

This should result in your devices being reconnected.

macOS-Security-and-Privacy-Guide