Usage

Once ebk-select is installed, it can be used from the terminal to interactively select a book and open it in the appropriate viewer.

To select and open a book in the default library, just run:

ebk-select

The available books will be displayed for selection in a fuzzy finder:

> _
0 Blood of Elves; Andrzej Sapkowski; Fiction, Fantasy; Orion
1 Insectivorous Plants; Charles Darwin; Non-fiction, Carnivorous plants; Project Gutenberg
2 The Odyssey; Homer, Samuel Butler; Epic poetry; Longmans, Green & Co.
3 Alice's Adventures in Wonderland; Lewis Carroll; Fiction, Children's stories; Project Gutenberg
4 Through the Looking-Glass; Lewis Carroll; Fiction, Children's stories; Project Gutenberg

Type a few letters from the title, authors, publisher, or tags:

> ody_
2 The Odyssey; Homer, Samuel Butler; Epic poetry; Longmans, Green & Co.
0 Blood of Elves; Andrzej Sapkowski; Fiction, Fantasy; Orion

When you confirm your selection, the e-book will be opened in the viewer associated with its file type on your system.

Opening ".../Homer/The Odyssey (3)/The Odyssey - Homer.epub" ...

Note: This requires xdg-open. Please see below if it is not provided by your system.

Specifying the library path

To search a library that is not in the default location, use the -l flag:

ebk-select -l ~/books/

This can also be set permanently: see the configuration instructions.

Choosing a specific file format

By default, ebk-select opens the EPUB file for the selected book, if there is one. Otherwise, it opens the first file it can find. To indicate a preference for a different file type, use the -f flag:

ebk-select -f pdf

Using a different selection program

By default, the interactive selection is delegated to the fzy command. To use a different command, e.g. fzf, use the -s flag:

ebk-select -s 'fzf --exact'

This can also be set permanently: see the configuration instructions.

Note: If you wish to use fzf as selection command, please ensure that you have fzf ≥ 0.53.0 (released in June 2024). Older versions do not work (issue #11).

Non-graphical or Windows/macOS systems

If your system does not provide the xdg-open command, use the -n flag to just print the path to the file, and pass the result to the correct program:

ebk-select -n | xargs -0 pdftotext | less
preview "$(ebk-select -n -f pdf)"

Note the use of the -0 flag for xargs: the path is zero-terminated (ends in a null byte) to allow it to be interpreted correctly by the shell, since the file name will typically contain spaces.

Alternatively, you could provide your own xdg-open script, executable and somewhere on your PATH. (See this blog post for an example.) ebk-select can then be run without the -n flag.