Fedora – dnsmasq with NetworkManager
I have been thinking of writing about this for long time but someone else did and it is nice write-up so here is the link – https://fedoramagazine.org/using-the-networkmanagers-dnsmasq-plugin/
I have been thinking of writing about this for long time but someone else did and it is nice write-up so here is the link – https://fedoramagazine.org/using-the-networkmanagers-dnsmasq-plugin/
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
Other day, I was trying to copy the proc folder with following command:
tar cvzf /tmp/proc.tgz /proc
and I found out that all the files in tar were empty. Strange it may seem but lot of people are facing this as /proc is not a regular filesystem, so I wrote a quick script to copy the proc folder. Here is the script:
cd /
mkdir /tmp/proc
[[ -z $1 ]] && exit -1
find /proc/$1/ -not -name pagemap | while read F ; do
D=/tmp/$F
if [[ -d $F ]]
then
echo "$(ls -ld $F) => Directory"
mkdir -p $D
fi
if [[ -L $F ]]
then
echo "$(ls -ld $F) => copied"
cp -P $F /tmp/$F
elif [[ -f $F ]]
then
echo "$(ls -ld $F) => Cat"
cat $F > /tmp/$F
else
echo "Dont know $F"
fi
done
I generallly keep doing this a lot, so thought will share with you. Lets assume we are capturing free ouput every min/hour/or whatever. The output looks like this:
Time: Mon Jan 21 23:59:10 AEDT 2019
——————-total used free shared buff/cache available
Mem: 32014 8656 1735 1697 21621 21308
Swap: 51195 75 51120
then we can use some grep and sed to convert this to something like this:
Mon Jan 21 23:59:10 AEDT 2019,32014,8656,1735,1697,21621,21308
Continue reading
I have been thinking of doing this for long time, finally I managed to get this working. Here is what you need to do to get i3 with all other gnome services running.
First we will create 2 files, this is actually all you need. In these ones, I copied the original gnome files and just change gnome-shell to i3 to replace my window manager.
11:15:43=>[
Continue reading]> cat /usr/share/gnome-session/sessions/gnome-i3.session]> cat /usr/share/xsessions/gnome-i3.desktop
[GNOME Session]
Name=GNOME + i3
# RequiredComponents=gnome-flashback-init;gnome-flashback;i3;gnome-settings-daemon;
RequiredComponents=i3;org.gnome.SettingsDaemon.A11ySettings;org.gnome.SettingsDaemon.Clipboard;org.gnome.SettingsDaemon.Color;org.gnome.SettingsDaemon.Datetime;org.gnome.SettingsDaemon.Housekeeping;org.gnome.SettingsDaemon.Keyboard;org.gnome.SettingsDaemon.MediaKeys;org.gnome.SettingsDaemon.Mouse;org.gnome.SettingsDaemon.Power;org.gnome.SettingsDaemon.PrintNotifications;org.gnome.SettingsDaemon.Rfkill;org.gnome.SettingsDaemon.ScreensaverProxy;org.gnome.SettingsDaemon.Sharing;org.gnome.SettingsDaemon.Smartcard;org.gnome.SettingsDaemon.Sound;org.gnome.SettingsDaemon.Wacom;org.gnome.SettingsDaemon.XSettings;
11:15:47=>[
[Desktop Entry]
Name=GNOME i3
Comment=This session logs you into GNOME + i3
Exec=env GNOME_SHELL_SESSION_MODE=gnome-i3 gnome-session –session gnome-i3
TryExec=gnome-session
Type=Application
DesktopNames=GNOME-Classic;GNOME;
Sometimes some simple one-liner function can save you a lot of time, like-
wps ()
{
rpm -q --whatprovides $(which $1 )
} # ---------- end of function wps ----------