Interesting bash aliases and functions:

Neat features

Edit a command in $EDITOR

Ctrl-x Ctrl-e will edit a command in $EDITOR before execution.

With set -o vi in bash/readline, v in command mode will do the same.

-v for testing set variables, while handling undefined ones

-v: True if the shell variable varname is set (has been assigned a value).

bash >=4.2 supports -v for testing for *set* variables while handling empty ones, also no specials needs when running under 'set -u':

   1 % cat foo
   2 FOO=''
   3 [ -z "${FOO:-}" ] && echo 1
   4 [ -z "${BAR:-}" ] && echo 2
   5 [ -v FOO ] && echo 3
   6 [ -v BAR ] && echo 4
   7 % bash -u ./foo
   8 1
   9 2
  10 3

source

also:

If you use bash, you should really use ]] instead of [ ]. It can do everything [ can (and then some, like ERE and glob matches), but is a shell keyword, which improves ergonomics quite a bit. See [ $x = 0 ] vs. [[ $x = 0 after unset x, for example.

Special Variables

See Special Parameters from the Bash Reference Manual.

"Strict Mode"

Tools

Use shellcheck with timonwong.shellcheck plugin.

Use bash-language-server.

Gotchas

Never Remember

Process Substition is the name for <(command) syntax.

Redirect stderr to stdout with 2>&1, e.g.:

Some-Command 2>&1 > log.txt