2023年8月26日 星期六

What I Learned Today (08/26/2023): Guide to Mastering Command Line and Shortcuts on Mac

Guide to Mastering Command Line and Shortcuts on Mac

Unlock the true potential of your Mac by mastering its command line interface and various keyboard shortcuts. Here's how.

Table of Contents

Check Mac Version

To check your Mac version, open the Terminal and type:

sw_vers -productVersion

Change Hostname

Change your Mac's HostName with the following commands:

  • Change HostName: sudo scutil --set HostName [nameyouwant]
  • Change temporary hostname: sudo hostname [mbpr]

Managing Applications

  • Start an application (e.g., TeamViewer): open -g -a /Applications/TeamViewer.app
  • Gracefully quit an application: osascript -e 'quit app "TeamViewer.app"'
  • Open multiple instances of VLC: /Applications/VLC.app/Contents/MacOS/VLC

User Management

For details on hiding, refer to Apple Support.

  • Disable a user: pwpolicy -u username disableuser
  • Enable a user: pwpolicy -u username enableuser
  • Hide a user from login screen: sudo dscl . create /Users/username IsHidden 1
  • Show a hidden user: sudo dscl . create /Users/username IsHidden 0

Browser Tricks

  • Add 'www' and '.com' to a URL: Press Control + Enter.
  • Reopen closed tab: ⌘ + Shift + T
  • Highlight URL bar: ⌘ + L
  • Open Incognito Mode: ⌘ + Shift + N
  • Clear cache and refresh: ⌘ + SHIFT + R

VLC Tips

  • Sync audio forward or backward: Press J or K.
  • Sync subtitles: Press H or G.

Miscellaneous Shortcuts

  • Lock screen: CMD+Ctrl+Q
  • Show dock: CMD+option+D
  • Maximize keyboard shortcut: Follow the guide in System Preferences > Keyboard settings.

Uninstalling Apps

  • 1. Go to LaunchPad.
  • 2. Drag the icon into your dock.
  • 3. Right-click on the icon and select Options > Show in Finder.
  • 4. Delete file.
  • 5. Right-click on the icon in the dock again and select Options > Remove from Dock.

Update Mac Using Terminal

  • Check for updates: softwareupdate -l
  • Install specific update: sudo softwareupdate -i 'macOS Catalina 10.15.4 Update- ' (note the space at the end)

沒有留言: