Giter Site home page Giter Site logo

kokatu's Introduction

kokatu

kokatu is a POSIX script which works as a wrapper for fd and ripgrep, bringing a similar functionality to mlocate, i.e, it indexes the system files and then allows the user to search in this index.

Requirements

For the base usage of kokatu, you only need to have fd and ripgrep installed. If you want to use compression, you will need to have lz4 in your system.

Usage

To create/update the index with kokatu, you just need to run the script with the option -u. You may be required to run this as root if you don't have read permissions of your user for the files selected by the <start-path>.

To search for an entry, you need to run the script with the pattern you want to search, kokatu <pattern>.

# Create/Update database
$ sudo kokatu -u

# Search for pattern 'README.md'
$ kokatu README.md

Options

The currently supported options are:

  • -d <database-path> - It overwrites the default path of the database/index [default: /tmp/kokatu.db]
  • -p <start-path> - It overwrites the default start path of the files to index [default: /]
  • -u - It updates/creates the database
  • -c - Return the number of matches, instead of the matches themselves
  • -i - Ignore case when searching
  • -v - Verbose

Compression

By default, kokatu doesn't compresses the index, however this can be enabled by changing the following line.

diff --git a/kokatu b/kokatu
--- a/kokatu
+++ b/kokatu
@@ -6,7 +6,7 @@

 kokatu_db="/tmp/kokatu.db"

-compression=""
+compression="Y"
 verbose=""

 rg_options="-z"

Performance

The following performance times were measured using hyperfine, with the command:

$ hyperfine --warmup 3 "locate README.md" "kokatu -d /tmp/kokatu.db README.md" "kokatu -d /tmp/kokatu_compressed.db.lz4 README.md"

The conditions of the indexes where the following:

Program Database Size Number of entries
mlocate 34M 1122686
kokatu (no compression) 103M 1199505
kokatu (with compression) 15M 1199505

TODO

  • Configuration file

kokatu's People

Contributors

dedukun avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.