Quiet Mind

Zsh Commands

The following is a guide to the commands and aliases available after configuring your system with the Quiet Mind macOS Bootstrap.

Fuzzy Finder

fzf is an interactive filter program for any kind of list; files, command history, processes, hostnames, bookmarks, git commits, etc. It implements a "fuzzy" matching algorithm, so you can quickly type in patterns with omitted characters and still get the results you want.

Tto quit interactive modes you can use any of the following keyboard shortcuts:

  • Escape
  • CTRL + C
  • CTRL + Q

Built-in Shell Integrations

  • CTRL + R: fuzzy search shell history
  • CTRL + T: fuzzy-insert a file path into the current command
  • OPTION + C: fuzzy cd into a subdirectory

Note: To enable OPTION + C you'll need to set "Left option key" to "ESC+" under Settings > Profiles > Keys in iTerm.

Usage

Pipe the contents of a file to perform a fuzzy search of its contents:

cat readme.md | fzf

Show a file browser with file content previews to the right side of the terminal:

fzf --style full --preview 'fzf-preview.sh {}' --bind 'focus:transform-header:file --brief {}'

You can pipe the output from other commands to fzf as needed.

fd --type f --hidden --no-ignore | fzf | xargs open

Zoxide

zoxide is a smarter cd command. It remembers which directories you use most frequently, so you can "jump" to them in just a few keystrokes.

Use z <directory> to quickly change to a directory

z

Use z in interactive mode (control-c to quit)

zi

Aliases and Custom Functions

General

Recursively search current directory, select a match with fuzzy search, and open it in nvim (ctrl-c to quit)

search <search term>

Recursively perform a live search on the current directory

livesearch

Clear the terminal output

cl

Change to the home directory and clear the terminal output

cdc

Make a new directory and change into the newly created directory

mkcd <directory>

Create an empty new file and if need create any directories in the path that don't already exist

mktouch <filename>

Delete every file except the specified file

keeponly <filename>

Print out the paths in $PATH, each on a new line

echopath

Copy the most recently run command to the clipboard

lc

Git

Check out the dev branch and pull the latest changes from the remote

pdev

Check out the main branch and pull the latest changes from the remote

pmain

Delete all local branches except current, master, main, dev

brclear

Delete local branches whose remote tracking branch no longer exists

brsync

Use fuzzy search to checkout a branch (ctrl-c to quit)

gco

Stash your current changes, including any untracked files

stash

Run git pull in each sub-directory if the repo is clean

pullall

Show the full patch diff for every commit in the log

logdiff

Shortcut to run git-quick-stats

gitstats

Shortcut to run lazygit (crtl-c to quit)

lg

Caffeinate

The awake command is an alias to use caffeinate to prevent idle sleeping (allow the displays to turn off, but keep the computer awake).

Prevent idle for 4 hours

awake 4h

Prevent idle until 4am

awake 4am

Prevent idle until a command completes

awake <command>

Sync Repo

The syncrepo command runs git pull, git add, git commit, and git push, with a default commit message of "updates" if none is provided. This is meant for private repositories where you don't really care to add verbose commit messages. You can also provide it with a commit message afterwards.

syncrepo

The syncrepo command uses cfg (my dotfiles bare repo git command) instead of git when run in the home directory.

Homebrew

Check for available updates

brewup update

Check and optionally upgrade packages

brewup upgrade

Developer Tools

To use jq you can use the command `json

json

To use yq you can use the command yaml

yaml

Network

Flush the DNS cache and restart the DNS responder service

flushdns

Show the local IP address

localip

Zsh

Reload zsh configuration

reload

Benchmark zsh startup time

timezsh

Add default flags to system commands

  • df: becomes df -h which outputs file system space usage in human-readable sizes in the power of 1024 (e.g. 1023M)
  • du: becomes du -ch which outputs a total disk usage in human-readable sizes in the power of 1024 (e.g. 1023M)
  • grep: becomes grep --color=auto which colorizes the output when stdout is a TTY
  • fgrep: becomes fgrep --color=auto which colorizes the output when stdout is a TTY
  • egrep: becomes egrep --color=auto which colorizes the output when stdout is a TTY
  • diff: becomes diff --color=auto which colorizes the output when stdout is a TTY
  • rg: becomes rg --smart-case which matches case-insensitively unless the pattern contains an uppercase letter, in which case it matches case-sensitively

Phoenix Window Manager

Change to the ~/.config/phoenix/ directory

cdphoenix

Change to the ~/.config/phoenix/ directory and tail the log file

logphoenix

Built with MDX Docs