missing sqlite3 history file

2.3k views Asked by At

I cannot find the command history created by sqlite3.

I have both Windows and Cygwin version.

Using the Windows binary, I can use up/down arrow to see previous commands, even from previous runs of command. But I can't find the file .sqlite_history. This answer suggests it should be in the home directory, but I can't find it there. I do have working a .sqliterc so I know it is the correct directory.

Using the Cygwin binary, I can't get the history to work at all. It seems history is not saved at all?

On the documentation page I cannot find any mention of history at all.

2

There are 2 answers

5
CL. On

For Windows console programs, the command history is handled by the Windows console itself. There are separate history buffers for different programs and different console sessions, and these buffers are not stored anywhere by default. However, you can use the doskey tool to manage them manually.

Cygwin uses Windows pipes to emulate the Unix tty devices; this often results in programs not detecting that they are running in a console. Try running the program both from within the Cygwin shell and from the Windows shell.

2
social On

The SQLITE_HISTORY environment variable, if it exists, specifies the name of the command-line editing history file

To repeat the last command, just press the ↑ key, to search for older ones — use Ctrl+R shortcut. History search It's faster to find a query than to type it again

By default, SQLite stores the history file in the user’s home directory and names it .sqlite_history It’s in plain text, so you can view it in your favorite editor. If you prefer to save it elsewhere, specify the full path in the SQLITE_HISTORY environment variable. source: https://antonz.org/sqlite-history

e.g:

cd ~
nano .sqlite_history