LinuxCommandLibrary

calibredb

Manage Calibre ebook library from command line

TLDR

List e-books in the library with additional information

$ calibredb list
copy

Search for e-books displaying additional information
$ calibredb list --search [search_term]
copy

Search for just ids of e-books
$ calibredb search [search_term]
copy

Add one or more e-books to the library
$ calibredb add [path/to/file1 path/to/file2 ...]
copy

Recursively add all e-books under a directory to the library
$ calibredb add [[-r|--recurse]] [path/to/directory]
copy

Remove one or more e-books from the library. You need the e-book IDs (see above)
$ calibredb remove [id1 id2 ...]
copy

SYNOPSIS

calibredb [global_options] command [command_options] [arguments]

Common command patterns:
calibredb add [options] path_to_ebook [path_to_ebook ...]
calibredb list [options]
calibredb search search_expression [options]
calibredb remove book_id [book_id ...]
calibredb set_metadata book_id [options]

PARAMETERS

--help
    Displays the help message for calibredb or a specific subcommand, then exits.

--version
    Shows the program's version number and exits.

--library PATH
    Specifies the path to the Calibre library to operate on. If omitted, the last opened library is used.

--with-library PATH
    Executes the command while temporarily setting the library path for the duration of the command.

--verbose
    Increases the verbosity of the output, showing more details about operations.

--debug
    Activates debug mode, providing extensive output for troubleshooting.

DESCRIPTION

calibredb is a powerful command-line utility provided with the Calibre ebook management software. It allows users to programmatically interact with Calibre libraries, performing operations such as adding, listing, searching, removing, and modifying ebook metadata. It is particularly useful for scripting, automation, and integrating Calibre functionality into other applications or workflows without needing the graphical user interface.

It can manage multiple libraries and access various book attributes, including authors, tags, series, and custom columns, making it an indispensable tool for advanced users and developers working with large ebook collections.

CAVEATS

calibredb requires a Calibre library to operate on, typically located in your user's documents directory. Incorrect usage, especially with commands like remove or set_metadata, can lead to irreversible data loss or corruption of your Calibre library database. Always backup your library before performing large-scale or critical operations.

Metadata changes made via calibredb might not immediately reflect in the Calibre graphical user interface until it is refreshed or restarted.

SUBCOMMANDS AND THEIR OPTIONS

While calibredb has global options, most of its functionality is accessed via subcommands (e.g., add, list, search). Each subcommand typically has its own set of specific options to control its behavior (e.g., calibredb list --sort-by title or calibredb add --authors 'John Doe'). Detailed help for each subcommand can be obtained by running calibredb command --help.

SCRIPTING AND AUTOMATION

calibredb is primarily designed for non-interactive use, making it ideal for shell scripts, cron jobs, or integration into larger systems that need to manage ebook collections. Its consistent output formats (like CSV, JSON, or tab-separated) for commands such as list and search facilitate easy parsing and processing by other tools.

HISTORY

calibredb was developed as an integral part of the broader Calibre project, initiated by Kovid Goyal in 2008. Its evolution has paralleled the growth of the Calibre graphical application, continuously expanding its capabilities to offer robust command-line access to library functions. This focus on command-line utility caters specifically to users and developers who require scripting, automation, or deeper integration of ebook management into their workflows.

SEE ALSO

calibre(1), ebook-convert(1), ebook-viewer(1)

Copied to clipboard