Spot an error? Know how to make this page better? I appreciate pull requests.

Bash

common shell notes

Line editing

Should work in bash and zsh, and in some readline environments.

^u # delete everything before the cursor
^k # delete everything after the cursor
^h # delete one character before the cursor
^d # delete character after the cursor
^w # delete from cursor to the start of previous word

Flow Control

If / else if / else

if [ "$foo" -eq 0 ]; then
  echo "true"
elif [ "$foo -gt 0 ]
  echo "false"
else
  echo "maybe"
fi

For loop.

for f in ${SET}; do
  echo "${f}"
done