GREP_COLORS – change the colors in the GREP output.

2019-04-22 4 min read Bash Linux

Today we will look at the variable GREP_COLORS. This variable determines the colour that is used with the grep command. You can look at the man page of the grep command to see what the various options mean. Here is the excerpt from the man command:

GREP_COLORS
          Specifies the colors and other attributes used to highlight various  parts  of  the
          output.   Its  value  is  a  colon-separated  list of capabilities that defaults to
          ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36  with  the  rv  and  ne   boolean
          capabilities omitted (i.e., false).  Supported capabilities are as follows.

          sl=    SGR  <a class="zem_slink" title="Substring" href="http://en.wikipedia.org/wiki/Substring" rel="wikipedia">substring</a>  for  whole  selected lines (i.e., matching lines when the -v
                 command-line option is omitted, or non-matching lines when -v is specified).
                 If however the boolean rv capability and the -v command-line option are both
                 specified, it applies to context matching lines  instead.   The  <a class="zem_slink" title="Default (finance)" href="http://en.wikipedia.org/wiki/Default_%28finance%29" rel="wikipedia">default</a>  is
                 empty (i.e., the terminal's default color pair).

          cx=    SGR  substring for whole context lines (i.e., non-matching lines when the -v
                 command-line option is omitted, or matching lines when -v is specified).  If
                 however  the  boolean  rv capability and the -v command-line option are both
                 specified, it applies to selected non-matching lines instead.   The  default
                 is empty (i.e., the terminal's default color pair).

          rv     <a class="zem_slink" title="Boolean data type" href="http://en.wikipedia.org/wiki/Boolean_data_type" rel="wikipedia">Boolean  value</a>  that  reverses  (swaps)  the  meanings  of  the  sl= and cx=
                 capabilities when the -v command-line option is specified.  The  default  is
                 false (i.e., the capability is omitted).

          mt=01;31
                 SGR  substring  for  matching  <a class="zem_slink" title="Empty set" href="http://en.wikipedia.org/wiki/Empty_set" rel="wikipedia">non-empty</a>  text in any matching line (i.e., a
                 selected line when the -v command-line option is omitted, or a context  line
                 when  -v  is specified).  Setting this is equivalent to setting both ms= and
                 mc= at once to the same value.  The default is a bold  red  text  foreground
                 over the current line background.

          ms=01;31
                 SGR substring for matching non-empty text in a selected line.  (This is only
                 used when the -v command-line option is omitted.)  The effect of the sl= (or
                 cx=  if  rv) capability remains active when this kicks in.  The default is a
                 bold red text foreground over the current line background.

          mc=01;31
                 SGR substring for matching non-empty text in a context line.  (This is  only
                 used  when  the -v command-line option is specified.)  The effect of the cx=
                 (or sl= if rv) capability remains active when this kicks in.  The default is
                 a bold red text foreground over the current line background.

          fn=35  SGR  substring  for file names prefixing any content line.  The default is a
                 magenta text foreground over the terminal's default background.

          ln=32  SGR substring for <a class="zem_slink" title="Line number" href="http://en.wikipedia.org/wiki/Line_number" rel="wikipedia">line numbers</a> prefixing any content line.  The default is a
                 green text foreground over the terminal's default background.

          bn=32  SGR substring for byte offsets prefixing any content line.  The default is a
                 green text foreground over the terminal's default background.

          se=36  SGR substring for separators that are inserted between selected line  fields
                 (:),  between context line fields, (-), and between groups of adjacent lines
                 when nonzero context  is  specified  (--).   The  default  is  a  cyan  text
                 foreground over the terminal's default background.

          ne     Boolean  value that prevents clearing to the <a class="zem_slink" title="Newline" href="http://en.wikipedia.org/wiki/Newline" rel="wikipedia">end of line</a> using Erase in Line
                 (EL) to Right (\33[K) each time a colorized item ends.  This  is  needed  on
                 terminals on which EL is not supported.  It is otherwise useful on terminals
                 for which the back_color_erase (bce) boolean terminfo  capability  does  not
                 apply,  when  the  chosen  highlight colors do not affect the background, or
                 when EL is too slow or causes too much flicker.  The default is false (i.e.,
                 the capability is omitted).

Continue reading

more clients for mpd.

2013-12-26 1 min read Fedora Linux

Here are some more clients that you can use with mpd.

sudo yum install mpd mpc qmpdclient.x86_64 gmpc.x86_64 sonata.x86_64

mpd is ::

Music Player Daemon (MPD) is a flexible, powerful, server-side application for
playing music. Through plugins and libraries it can play a variety of sound
files (e.g., OGG, MP3, FLAC, AAC, WAV) and can be controlled remotely via its
network protocol. It can be used as a desktop music player, but is also great
for streaming music to a stereo system over a local network. There are many
GUI and command-line applications to choose from that act as a front-end for
browsing and playing your MPD music collection.

Continue reading

pkgwat -search packages for Fedora.

2013-08-23 1 min read Fedora

pkgwat is a nice utility to search the fedora packages websearch.

Description : Pronounced "package WAT", pkgwat is a fast CLI tool for querying
: the fedora packages webapp.
: https://apps.fedoraproject.org/packages/
:
: You can make its search even better by helping us tag packages.
: https://apps.fedoraproject.org/tagger

And to search for  a package, you can use ::

pkgwat search 
pkgwat -h # get help on package.

 

Continue reading

viewvc – serve current directory in web interface.

2013-02-18 1 min read Fedora

Here is the description of viewvc:

ViewVC is a browser interface for CVS and Subversion version control
repositories. It generates templatized HTML to present navigable directory,
revision, and change log listings. It can display specific versions of files
as well as diffs between those versions. Basically, ViewVC provides the bulk
of the report-like functionality you expect out of your version control tool,
but much more prettily than the average textual command-line program output.

Continue reading

vim mappings for multiple files.

2012-08-06 1 min read Vim Tips

If you open multiple files in vim with command line option. Then the only way to move between the files is “:n” and “:N”. There is a easier way to do this. Just add mappings for this in vimrc. Here is what you can use.

map  :N
map  :n

And if you want to make sure that you move to the prev or next file after saving the file, then you modifyt the mapping like this:

Continue reading

C program to get the ascii string from a string

2012-07-25 1 min read C Programs
Example diagram of the printf function in the ...
Example diagram of the printf function in the C programming language (Photo credit: Wikipedia)

Lot of times, you would like to get the complete string in hex or ascii format and if you are one of them then this is something that will be helpful for you 🙂

Example output:

lp-amita[d=~/bin]> ./ascii aamit
String – aamit, Length – 5

Continue reading

Music players on Linux – the poor mans random song player.

2012-07-20 1 min read Fedora Learning Linux

If you have more applications running on your system then your system can handle them then you know what I mean when I say that the Music Players take a lot of CPU. Otherwise harmless, but when you are doing too many things, then lot of times you would feel that probably stopping the Music player might help. But then Linux is all about alternatives. So, there is a command line player called mpg123, which does not use so much CPU. But what about playlist 🙂

Continue reading
Older posts