You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 12, 2025. It is now read-only.
BORG – Search and save shell snippets without leaving your terminal
Borg was built out of the frustration of having to leave the terminal to search and click around for bash snippets.
Glance over multiple snippets quickly with Borg's succinct output.
PLEASE READ: The website (https://ok-b.org) is down, because I didn't have time to maintain it.
You can host borg yourself, and we plan to resurrect the version hosted by us on 1backend (https://github.com/1backend/1backend).
The ETA for this is a couple of months.
Search
borg "list only files"
(1) Bash: How to list only files?
[a] find . -maxdepth 1 -type f
[b] ls -l | egrep -v '^d'
ls -l | grep -v '^d'
(2) List only common parent directories for files
[a] # read a line into the variable "prefix", split at slashes
IFS=/ read -a prefix
# while there are more lines, one after another read them into "next",# also split at slasheswhile IFS=/ read -a next;do
new_prefix=()
# for all indexes in prefixfor((i=0; i < "${#prefix[@]}"; ++i));do# if the word in the new line matches the old oneif [[ "${prefix[i]}"=="${next[i]}" ]];then
...
Use borg pipeto less to pipe the results straight to less (or another program).
When a result works for you, use the worked command to give feedback:
borg worked 12
This will rank the result higher for similar queries—especially helpful when a good result was buried in the search results.
Advanced usage
For more commands and their explanations, please see advanced usage.
How does borg work?
The client connects to a server at ok-b.org. You can host your own server too (see daemon folder), though self-hosting will become less appealing once people start contributing their own content to the database.
UI explanation
() denotes hits for your query
[] denotes snippets found for a given query
... under a [] means more lines to display (use the -f flag for full display, see more about usage below)