Skip to content

Latest commit

 

History

History
136 lines (102 loc) · 4.26 KB

macos-usage.md

File metadata and controls

136 lines (102 loc) · 4.26 KB

macOS Usage

macOS Shortcuts

Key Function
cmd + ` (grave accent) switch between windows of a same program

Shortcut List

BSD Bash/Zsh

  • Display disk usage statistics sorted by human readable numbers

    # see "brew info dust"
    dust -d1
    
    # use GNU sort which supports "-h" option, "brew info coreutils"
    $ du -hd 1 | gsort -h

    https://serverfault.com/a/156648

  • Open man page in new terminal window open x-man-page://<name> https://scriptingosx.com/2017/04/on-viewing-man-pages/

  • zip and unzip

    # dry run, list files
    unzip -l file.zip
    
    # unzip specific file
    unzip file.zip path/to/file.txt     # this will create "./path/to/file.txt"
    
    # unzip specific file and drop directory structures in archive
    unzip -j file.zip path/to/file.txt  # this will create "./file.txt"
  • Remove duplicates in zsh history (ref)

    cat -n $HISTFILE | sort -t ';' -uk2 | sort -nk1 | cut -f2- > .zsh_short_history

    problematic with multiline history entries

Zsh

GNU CLI Tools

  • Show dependencies as a tree: brew deps --tree <formula>
Name Homebrew formula
ggrep brew info grep
gsed brew info gnu-sed
gsort brew info coreutils

CLI Tricks

Homebrew

brew CLI program

https://docs.brew.sh/Manpage

Writing formulae and casks

Where do PATHs come from

  1. /etc/profiles
  2. /usr/libexec/path_helper -s
  3. /etc/paths + file lines under /etc/paths.d
  4. shell profiles (e.g., zsh startup files) see ref