Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Line Editing

Hash shell includes a custom line editor with full cursor navigation and editing capabilities.

Key Bindings

Cursor Movement

KeyAction
Left ArrowMove cursor left
Right ArrowMove cursor right
Up ArrowPrevious command in history
Down ArrowNext command in history
Ctrl+AMove to beginning of line
Ctrl+EMove to end of line
HomeMove to beginning of line
EndMove to end of line

Editing

KeyAction
BackspaceDelete character before cursor
DeleteDelete character at cursor
Ctrl+HSame as Backspace
Ctrl+UDelete from cursor to beginning
Ctrl+KDelete from cursor to end
Ctrl+WDelete word backward

Other

KeyAction
TabAuto-complete
Ctrl+LClear screen
Ctrl+CCancel current line
Ctrl+DEOF (exit if line empty)
EnterSubmit command

Features

Insert Mode

Hash uses insert mode (like bash):

  • Typing inserts characters at cursor position
  • Existing text shifts right
  • Edit anywhere in the line
hello world
     ^
     cursor

Type 'beautiful ' → hello beautiful world

Tab Completion

Press TAB to auto-complete:

Single match:

#> ec<TAB>
#> echo   # Completed with space

Multiple matches - first TAB:

#> cat te<TAB>
#> cat test  # Common prefix

Multiple matches - second TAB:

test.txt  test.md  testing.log
#> cat test

See Tab Completion for details.

Ctrl+C Handling

Cancel current input and get a fresh prompt:

#> some long command^C
#>

Ctrl+D Behavior

  • On empty line: Exits the shell
  • On non-empty line: Does nothing

Tips & Tricks

Quick Edits

# Typed wrong command
#> cat file.tx
# Press Ctrl+A, Ctrl+K, type correct command

Delete Mistakes

#> echo hello worldddd
# Press Ctrl+W to delete "worldddd"
#> echo hello

Clear and Restart

#> some complex command
# Press Ctrl+U to clear
#>

Cancel Without Running

#> rm -rf /important
# Press Ctrl+C
^C
#>

Troubleshooting

Keys Not Working

Check terminal type:

echo $TERM
# Should be xterm, xterm-256color, etc.

Arrow Keys Print Escape Sequences

Set proper terminal:

export TERM=xterm-256color

Comparison with Bash

Supported (Same as Bash)

  • Arrow key navigation
  • History navigation
  • Ctrl+A, Ctrl+E
  • Ctrl+U, Ctrl+K, Ctrl+W
  • Ctrl+L, Ctrl+C, Ctrl+D
  • Home/End keys
  • Insert mode

Not Yet Supported

  • Ctrl+R (reverse search)
  • Ctrl+T (transpose)
  • Alt key bindings
  • Vi mode
  • Custom key bindings