what is the command to move the cursor to the start of the current line?

6 hours ago 3
Nature

The command to move the cursor to the start of the current line depends on the context:

  • In a typical Linux terminal or shell (e.g., Bash or Zsh), you can press Ctrl + A to move the cursor to the beginning of the line
  • In the vi or vim editor, pressing 0 (zero) moves the cursor to the start of the current line
  • In the vi editor, pressing ^ moves the cursor to the first non-blank character of the current line
  • On macOS Terminal, Ctrl + A also works, though some users prefer to use Command + Left Arrow in other editors, but this is not always supported in the terminal itself
  • In Windows Terminal, the Home key moves the cursor to the beginning of the line, as Ctrl + A is not always supported there

Summary:

Environment| Command to Move Cursor to Start of Line
---|---
Linux Terminal (Bash, Zsh)| Ctrl + A
vi / vim editor| 0 (zero) or ^ (first non-blank character)
macOS Terminal| Ctrl + A (Command + Left Arrow in some editors)
Windows Terminal| Home key

This covers the most common scenarios for moving the cursor to the start of the current line.