Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I start typing a multi-line command on the SQLite shell, and change my mind mid-way, how do I get back to shell prompt again without causing SQLite to execute the current command?

sqlite> INSERT INTO
   ...> mytable VALUES
   ...> ^C                  <---- changed my mind here, but ^C doesn't work
   ...>;                    <---- had to type ; to end the command
Error: near ";": syntax error   <---- want to avoid this

As you can see above, SQLite tried to execute invalid command. Is there a way I can press a key combination and return to a clean prompt again?

share|improve this question

Try pressing CtrlU which will erase from the cursor to the beginning of the line. To erase from the cursor to the end of the line, if needed: CtrlK

share|improve this answer
    
Thanks, but any way to totally clear the command buffer? Previous lines too! – slowpoison Jun 5 '12 at 0:41
    
@slowpoison: The keystrokes I listed are from the readline library which SQLite uses if it's available. Readline doesn't have a clear-history function as far as I know. – Dennis Williamson Jun 5 '12 at 0:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .