Skip to content

Instantly share code, notes, and snippets.

@ngscheurich
Last active April 8, 2021 23:28
Show Gist options
  • Save ngscheurich/b0605428cb3ed850664257672d0ad4e6 to your computer and use it in GitHub Desktop.
Save ngscheurich/b0605428cb3ed850664257672d0ad4e6 to your computer and use it in GitHub Desktop.
title author date
Tales of a Shell Dweller
N. G. Scheurich
2010-04-06

Zsh

Zsh is a shell designed for interactive use, although it is also a powerful scripting language.

http://zsh.sourceforge.net/

Pro Tips

Improve the history experience:

setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_FIND_NO_DUPS
setopt HIST_IGNORE_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY

HISTFILE=$ZDOTDIR/.zsh_history
HISTSIZE=10000
SAVEHIST=10000

Easy access to shell configuration:

alias zshconfig='$EDITOR $ZDOTDIR/.zshrc'
alias zshsource='source $ZDOTDIR/.zshrc'

Better backspacing:

autoload -U select-word-style
select-word-style bash

exa

exa is a modern replacement for ls.

https://github.com/ogham/exa

Examples

$ exa dir

$ exa -la dir

$ exa  --icons --git dir

$ exa -T dir

$ exa -I .git

Pro Tips

Configure some handy aliases:

alias l='exa'
alias la='exa --long --all'
alias lg='lazygit'
alias ll='exa --long'

bat

A cat(1) clone with syntax highlighting and Git integration.

https://github.com/sharkdp/bat

Examples

$ bat file

$ bat -A file

$ bat dir/*

$ bat file -l json

fd

A simple, fast and user-friendly alternative to 'find'

https://github.com/sharkdp/fd

Example

$ fd name

$ fd -H name

$ fd '^startswith.*'

$ fd name -x vim

$ fd name -X bat

fasd

Command-line productivity booster, offers quick access to files and directories, inspired by autojump, z and v.

https://github.com/clvv/fasd

Examples

$ z dirpart

$ zz

$ f

$ sf

fzf

fzf is a general-purpose command-line fuzzy finder.

https://github.com/junegunn/fzf

Examples

$ lines | fzf

$ lines | fzf --multi

$ $EDITOR `fd '^startswith.*' | fzf`

Pro Tips

Use the shortcuts created by the FZF install script:

  • CTRL-T - Pick files in current directory
  • CTRL-R - Pick shell history
  • ALT-C - Pick directory, then cd

Use a ' (straight quote) to match entire input string:

  • spine will match "spine" and "spindle"
  • 'spine will match "spine" but not "spindle"

Pick from filesystem auto-completion:

$ command dir/**<TAB>

Configure default options to render previews:

export FZF_CTRL_T_OPTS="--preview \
  'bat --color=always --style=numbers \
  --line-range=:500 {}'"
export FZF_ALT_C_OPTS="--preview 'tree -C {}'"

Steal stuff from the FZF wiki:

https://github.com/junegunn/fzf/wiki/Examples

tldr

Collaborative cheatsheats for console commands

https://github.com/tldr-pages/tldr

Examples

$ tldr tar

$ tldr --update

thefuck

The Fuck is a magnificent app, inspired by a @liamosaur tweet, that corrects errors in previous console commands.

https://github.com/nvbn/thefuck

Examples

$ fuck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment