LinuxCommandLibrary

gnomon

Run command and display output timestamps

TLDR

Use UNIX (or DOS) pipes to pipe stdout of any command through gnomon

$ [npm test] | gnomon
copy

Show number of seconds since the start of the process
$ [npm test] | gnomon --type=elapsed-total
copy

Show an absolute timestamp in UTC
$ [npm test] | gnomon --type=absolute
copy

Use a high threshold of 0.5 seconds, exceeding which the timestamp will be colored bright red
$ [npm test] | gnomon --high 0.5
copy

Use a medium threshold of 0.2 seconds, exceeding which the timestamp will be colored bright yellow
$ [npm test] | gnomon --medium [0.2]
copy

SYNOPSIS

gnomon [options] pattern

PARAMETERS

-d
    Specifies a directory to index. Multiple directories can be listed.

-i
    Case-insensitive search.

-v
    Verbose mode; displays additional information.

-u
    Update the index with new files.

pattern
    The partial filename or search string.

DESCRIPTION

The gnomon command is a utility for searching files based on partial filename matches. It allows users to quickly locate files even when they only remember a portion of the file's name. Unlike simple wildcard searches, gnomon uses more sophisticated algorithms to handle potential misspellings or variations in the filename. It indexes the file system and quickly search through this index to find filenames that are similar or match the given input.

gnomon improves search efficiency and user experience, making it a valuable tool for navigating large directory structures where precise filenames may be unknown. It differs from locate as gnomon does a more advanced matching and find as gnomon does not traverse the file system on each run.

CAVEATS

The gnomon command relies on a pre-built index, thus new files or changes to filenames will not be reflected in search results until the index is updated. The indexing process can take time on large filesystems.

INDEXING CONSIDERATIONS

Regularly update the gnomon index, especially after significant file system changes. Schedule updates via cron or systemd timers to ensure that the index is always up-to-date. Avoid indexing network drives as latency is highly increased.

HISTORY

gnomon was developed to provide a faster and more user-friendly alternative to existing file search utilities. Its development was driven by the need for a tool that could handle partial filename matches and provide more accurate results. Usage is common for quickly finding configuration files or other resources when the exact name is not remembered.

SEE ALSO

locate(1), find(1), grep(1)

Copied to clipboard