diff --git a/README.md b/README.md index a1109d58..dcdce11d 100755 --- a/README.md +++ b/README.md @@ -553,13 +553,25 @@ A few examples of piecing together commands: These are items relevant *only* on macOS. +- Default Terminal in MacOS is `zsh`. Although most of the commands listed in this guide will work just fine, please keep in mind some `bash` scripts may through errors or produce unexpected results. + - Package management with `brew` (Homebrew) and/or `port` (MacPorts). These can be used to install on macOS many of the above commands. -- Copy output of any command to a desktop app with `pbcopy` and paste input from one with `pbpaste`. +- Copy output of any command to a file with `pbcopy < file.txt` or `cat file.txt | pbcopy` + +- Paste input from one with `pbpaste`. + +- Count items in clipboard: `pbpaste | wc -l` + +- Strip formatting from clipboard: `pbpaste | pbcopy`. - To enable the Option key in macOS Terminal as an alt key (such as used in the commands above like **alt-b**, **alt-f**, etc.), open Preferences -> Profiles -> Keyboard and select "Use Option as Meta key". -- To open a file with a desktop app, use `open` or `open -a /Applications/Whatever.app`. +- To open a file with a desktop app, use `open -a "Application Name"` or `open -a /Applications/Whatever.app`. + +- To reveal a folder in `Finder`, pleae use `open -R /path/to/file` + +- Show/hide hidden files in Finder: `defaults write com.apple.finder AppleShowAllFiles YES && killall Finder`. - Spotlight: Search files with `mdfind` and list metadata (such as photo EXIF info) with `mdls`. @@ -567,6 +579,24 @@ These are items relevant *only* on macOS. - To get macOS release information, use `sw_vers`. +- Get detailed hardware info with `system_profiler` and `system_profiler SPHardwareDataType for Mac` specs. + +- Check battery status with `pmset -g batt` and power management settings with `pmset -g`. + +- View system logs with `log show` or stream them in real-time with `log stream`. + +- List all running applications with `osascript -e 'tell application "System Events" to get name of every process whose background only is false'`. +- Force quit applications from terminal with `killall [AppName]` or `pkill`. + +- Flush DNS cache with `sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder`. + +- View active network connections with `netstat -an` or `lsof -i`. + +- Get current Wi-Fi network with `networksetup -getairportnetwork en0`. + +- Scan available Wi-Fi networks: `/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -s`. + + ## Windows only These items are relevant *only* on Windows.