Skip to content

Shell Wiki

Diff two directories

diff --brief --recursive -x '.git' -x 'autoload' \
    ~/.config/nvim ~/

Find and replace recursively in a directory

find docs -name '*.md' | xargs sed -i "" 's/\[/\[:fontawesome-solid-link: /g'


Note: -i "" is only for MacOS. More here.

Moving around

# inspiration from
# cd to the root of git repo
alias cdr="cd $(git rev-parse --show-toplevel)"

# use fzf to quickly cd into subdirectories
function c() {
  local selected_directory
  selected_directory=$(fd -t d | fzf --height=6 --layout=reverse)

  if [ -n "$selected_directory" ]; then
    cd $selected_directory

Ignore directories with tree

tree -I '__pycache__|node_modules|test_*'