You are not logged in.
Pages: 1
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?
Offline
Hello:
Sorry for reviving an oldish thread but I just came across your post.
These days I seem to have more time to read unanswered posts .... =-/
One of the things I like of how Devuan ascii is implemented is how console output is highlighted at boot time and when using commands such as dmesg.
Unfortunately, the output of dmesg | grep whatever gets written to the terminal without any highlighting.
Is there a way to fix/change this so that anything printed to the terminal has the same highlighted output/behaves in the same manner, irrespective of whatever comes after the command line instruction?
It would be nice to have it enabled by default.
Thanks in advance,
A.
Offline
I think that dmesg auto detects whether the output is to the screen or not and turns on colour or not!
There is a switch --color=[auto|always|never], so I think what you need is :-
dmesg --color=always | cat
Geoff
Offline
Hello:
Thanks for the prompt reply.
... dmesg auto detects whether the output is to the screen or not and turns on colour or not!
There is a switch --color=[auto|always|never], so I think what you need is :-dmesg --color=always | cat
Right ...
That works ...
Using the switch the difference between sudo dmesg | grep whatever and sudo dmesg --color=always | grep whatever is that the highlighting is turned on.
Now, sudo dmesg is always highlighted but not by my using any switch so I guess there is a setting/place where that switch is applied.
Where might that setting be?
Thanks in advance,
A.
Offline
The default is color=auto according to man dmesg. The man page also has a section on COLORS and it apparently also uses settings in /etc/terminal-colors.d/dmesg.disable. It refers us to man terminal-colors.d. It would appear that it is possible to have some control over what colours are used for different parts of the output.
I use rxvt as my terminal and it is able to display colours.
Geoff
Offline
Hello:
The default is color=auto according to man dmesg.
Thank you for pointing that out in such a gentle manner.
Should know better by now, must make it a point of looking through the man files before asking. =-7
... page also has a section on COLORS ...
I'll have a good look at that and see if I can replace auto with always.
I use rxvt as my terminal and it is able to display colours.
I'll check that out also.
Thanks a lot, you have been very helpful.
Cheers,
A.
Offline
Hello:
I'll have a good look at that and see if I can replace auto with always.
I have not been able to find out where to change this.
As I have mentioned, the output of dmesg is highlighted but the output of dmesg | grep whatever is not.
As expected, dmesg --color=always | grep whatever is highlighted.
My reasoning is that there is a script or file somewhere that sets dmesg to dmesg --color=auto, otherwise the output would be in the default b+w.
I've looked at the dmesg and terminal-colors.d man files to no avail.
There are references to $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d to override the global setting but what I would like to is to change the global setting from dmesg --color=auto to dmesg --color=always for all the cli utilities I use, not only dmesg. eg: ls, dir, etc.
It seems that aliases could be generated to do that but I think it would be better to make the change globally.
Is that at all possible?
Thanks in advance,
A.
Offline
Hello:
Is that at all possible?
Finally found a clue here:
https://askubuntu.com/questions/103913/ … l-commands
The solution is within ~/.bashrc, where you have to edit this section of the script ...
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
#alias dir='dir --color=auto'
#alias vdir='vdir --color=auto'
#alias grep='grep --color=auto'
#alias fgrep='fgrep --color=auto'
#alias egrep='egrep --color=auto'
fi
... to get this:
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=always'
alias dir='dir --color=always'
alias vdir='vdir --color=always'
alias grep='grep --color=always'
alias fgrep='fgrep --color=always'
alias egrep='egrep --color=always'
alias dmesg='dmesg --color=always'
fi
Basically what this is does is generate aliases with the --color=always modifier.
From what I have read in the link, it would seem that the --color= modifier is hard coded into dmesg as well as other utilities.
eg: apparently dir does not have it but ls does.
Cheers,
A.
Offline
hi Altoid
I am sure Geoff 42 has a better config. I prefer lxterminal but when I use rxvt I have a home config that looks like this.
cat .Xdefaults
! rxvt
URxvt*background: Black
URxvt*foreground: White
URxvt*geometry: 117x55
URxvt*scrollBar: true
URxvt*rightScrollBar: true
! -- Fonts -- !
URxvt.font: xft:dejavu DejaVuSans:size=13:antialias=true
URxvt.letterSpace: -1
that is almost max the window on a monitor with 1920x1080
I stole it from someone else on a different forum.
hope that helps
Last edited by aus9 (2020-03-30 04:31:54)
Offline
Pages: 1