Skip to main content

The file(1) command can read SQLite databases

  • Posted

It can identify a SQLite database and give you basic information about the version, page count, encoding, and more.

Here’s a neat trick that Percy showed me today: the file(1) command is able to recognise SQLite databases, and print some information about the structure of the database.

Here’s an example from my Mac:

$ file example.db
example.db: SQLite 3.x database, last written using SQLite version 3050004, file counter 89, database pages 4, cookie 0x2, schema 4, UTF-8, version-valid-for 89

These values are read from the database header, the first 100 bytes of the file which include information about the database. A couple of fields stood out to me: