Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.