The officially official Devuan Forum!

You are not logged in.

#1 2019-11-19 01:32:43

Registered: 2019-10-21
Posts: 54  

the benefits of highlighting console output

i do a lot of stuff on the command line, and i have a sort of swiss-army-tool with the extras i rely on most. i actually created it to help people learn a bash-like command line in windows, before migrating.

but the picture here shows the output of find piped to "fsortplus", one of the tools i use that shows filesize, sha256sums, date/time and full paths.


what im doing is looking for any duplicates of the stylus plugin-- ive found 3.

there are various ways i can deal with the fact that all the long white-on-black text lines run together, but what i decide to do is just add rainbow -f to the pipeline.

if i was running the alex shell, i wouldnt need to call it. i could just say | rainbow -f

but since im running bash instead, i can still call the tool the way shown here.

the hashsums are trivial to distinguish in yellow. -f means "field" and there are other options for the rainbow command.

--inksearch is a multi-colour highlighter (not shown) it differs from grep in that it shows not only lines containing the search queries, it shows the surrounding lines. if you want to isolate those lines you can use egrep or isoname.

so highlight "foo" yellow, "bar" red and "baz" light blue, you would do this:

| inksearch "foo|bar|baz 14 12 9"

ordinarily i put all these tools together in one large python script. but if youd like to play with that or if youd like me to isolate either or both of those parts of the script, let me know. i havent included any of the code here, as 1. no one has asked and 2. you may want to write your own highlighter tools instead. but the code is public domain if theres any interest.

monopolies are able to change free software so it better serves their freedom than ours.

why is that so difficult to prove to many free software advocates, and what is it that stops them from caring?


Board footer