1

Episode 144 – Ode to #!

Posted by Tony on February 8, 2015 in Show-mp3, Show-ogg |
Play

http://smlr.us

Downloads:

MP3 format (for Freedom Haters!)
OGG format (for Freedom Lovers!)
Total Running Time: 1:14:29

Un-edited Live session – http://www.youtube.com/watch?v=spGNvTAGmd0

Contact Us:

show (at) smlr.us or the Contact us page

Summary

Kernel News: Mat
Time: 15:40
Distro Talk: Tony
Time: 18:45
Tech News:
Time: 33:25
Toolbox
Time: 40:25
Listener Feedback
Time: 1:01:05
Outtro Music
Time: 1:06:05


Intro:

Tony Bemus, Mat Enders, and Mary Tomich
Sound bites by Mike Tanner

Kernel News: Mat

Time: 15:40

mainline:	3.19-rc7	2015-02-02
stable: 	3.18.6  	2015-02-06
stable: 	3.17.8 [EOL]	2015-01-08
longterm:	3.14.32 	2015-02-06
longterm:	3.12.37 	2015-01-30
longterm:	3.10.68 	2015-02-06
longterm:	3.4.106 	2015-02-02
longterm:	3.2.66  	2015-01-01
longterm:	2.6.32.65	2014-12-13
linux-next:	next-20150204	2015-02-04	

Distro Talk: Tony

Time: 18:45

Distrowatch.com

  • 1-28 – GParted Live 0.21.0-1
  • 1-29 – BackBox Linux 4.1
  • 1-31 – SolydXK 201501
  • 2-1 – Black Lab Linux 6.0 SR3
  • 2-2 – BSD Release: PC-BSD 10.1.1
  • 2-2 – Raspbian 2015-01-31
  • 2-3 – Simplicity Linux 15.1
  • 2-4 – Q4OS 0.5.25
  • 2-7 – Manjaro Linux 0.8.12
  • 2-7 – Korora 21

Distro of the Week: Tony

  1. openSUSE – 1318
  2. Black Lab – 1418
  3. Ubuntu – 1709
  4. Debian – 1714
  5. Mint – 3029

Tech News:

Time: 33:25

First Ever Ubuntu Phone Unboxing Video Appears Online
http://www.omgubuntu.co.uk/2015/02/first-ever-ubuntu-phone-unboxing-video-appears-online

Ubuntu smartphone offers alternative to apps
http://www.bbc.com/news/technology-31148661

 

Massive Utah cyberattacks — up to 300 million per day — may be aimed at NSA facility

http://www.sltrib.com/news/2135491-155/massive-utah-cyber-attacks-may-be

Mary’s Kool Tools

How to create and show a presentation from the command line on Linux

http://xmodulo.com/presentation-command-line-linux.html


The Toolbox

Time: 40:25

grep – Google for the shell

The grep command was created by Ken Thompson as a standalone application adapted from the regular expression parser he had written for ed, which he also created. In ed, the command g/re/p would print all lines matching a previously defined pattern. Some believe it is an acronym for global regular expression print, this is a misnomer. In the beginning people extended grep by forking it into other programs hence we get fgrep (searches for a litteral string appling no regex), egrep (uses extended regex), and pcregrep (uses Perl compliant regex). Now however all of that functionality has been incorporated into grep itsself with the following flags respectively -F, -E, and -P. The grep is considered one of the most useful commands in any Unix system.

The grep command always works the same way. Beginning at the first line in the file, grep copies a line into a buffer, compares it against the search string, and if the comparison passes, prints the line to the screen. Grep will repeat this process until the file runs out of lines. Notice that nowhere in this process does grep store lines, change lines, or search only a part of a line.

The simplest way to use grep would be:

grep 'smith' etc_passwd_0.txt
jsmith:x:1019:1019:Jacob Smith:/home/jsmith:/usr/bin/zsh
asmith:x:1144:1144:Aaron Smith:/home/asmith:/usr/bin/zsh

NOTE: throughout this document I will use single quotes around ny search terms. This is not always necesasary and these examples will all work without them. If however your searchterm contains a space they are necessary. Double quotes can also be used. If you wanted to search for either a single quote or a double quote you would need to escape it.

In this example, grep would loop through every line of the file “etc_passwd_0.tx” and print out every line that contains the text “smith.” If you want to use these examples, you will need my example file from here, http://csittechs.com/presentations/. There are two files there that have basically identical content, except one is colon delimited (etc_passwd_0.txt) and the other space delimited (etc_passwd_1.txt). For this exercise in grep either will work.

That first example is great but what if it is a large file and you want know where these lines are to edit. You could use the -n flag.

grep -n 'smith' etc_passwd_0.txt
52:jsmith:x:1019:1019:Jacob Smith:/home/jsmith:/usr/bin/zsh
177:asmith:x:1144:1144:Aaron Smith:/home/asmith:/usr/bin/zsh

This tells us that these lines are 52 and 177 respectively. Another useful flag and one I use often is the -v flag. It will give you the negative results of your search.

grep -v ':1' etc_passwd_0.txt
root:x:0:0:root:/root:/bin/bash
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
nobody:x:99:99:Nobody:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:999:User for polkitd:/:/sbin/nologin
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
colord:x:998:997:User for colord:/var/lib/colord:/sbin/nologin
pulse:x:997:996:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
chrony:x:996:994::/var/lib/chrony:/sbin/nologin
tss:x:59:59:Account to sandbox the tcsd daemon:/dev/null:/sbin/nologin
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
unbound:x:995:993:Unbound DNS resolver:/etc/unbound:/sbin/nologin
openvpn:x:994:992:OpenVPN:/etc/openvpn:/sbin/nologin
nm-openconnect:x:993:991:NetworkManager user for OpenConnect:/:/sbin/nologin
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin

As you see it printed every line that does not contain a “:1”. The -c flag counts the lines that would have been printed by your search

grep -c '/usr/bin/bash' etc_passwd_0.txt
120

It tells that 120 of the users are using the bash shell as there default shell. Then we have the -i flag which will make your search case insensitive.

grep -i 'maria' etc_passwd_0.txt
mysql:x:27:27:MariaDB Server:/var/lib/mysql:/sbin/nologin
mwatson:x:1115:1115:Maria Watson:/home/mwatson:/usr/bin/bash
mfoster:x:1179:1179:Maria Foster:/home/mfoster:/usr/bin/tcsh

Now you see that we searched for maria all lowercase however our search matched the pattern Maria with an uppercase M. We also can use regular expressions to search out complex patterns. If we wanted to find all the user with uids or gids 1004, 1005, 1006, 1007, 1104, 1105, 1106, and 1107, we could do this.

grep -E ':1[01]0[4-7]:' etc_passwd_0.txt
njenkins:x:1004:1004:Noah Jenkins:/home/njenkins:/usr/bin/zsh
shayes:x:1005:1005:Stephanie Hayes:/home/shayes:/usr/bin/bash
cscott:x:1006:1006:Caleb Scott:/home/cscott:/usr/bin/bash
mwood:x:1007:1007:Morgan Wood:/home/mwood:/usr/bin/bash
asimmons:x:1104:1104:Allison Simmons:/home/asimmons:/usr/bin/tcsh
jreed:x:1105:1105:Jose Reed:/home/jreed:/usr/bin/tcsh
lward:x:1106:1106:Lily Ward:/home/lward:/usr/bin/bash
iperez:x:1107:1107:Isabella Perez:/home/iperez:/usr/bin/bash

Our search pattern printed the eight lines we were looking for. You can even do more by combining flags to refine your searc. Remeber ealier when we searched for ‘maria’ and we got back two users and the system ‘MariaDB’ user. Well if we only wanted the human users we could do something like this.

grep -iE 'maria\b' etc_passwd_0.txt
mwatson:x:1115:1115:Maria Watson:/home/mwatson:/usr/bin/bash
mfoster:x:1179:1179:Maria Foster:/home/mfoster:/usr/bin/tcsh

Now we only are returned the two human users because told grep the the end of the word would be after the ‘a’ with the ‘\b’ which stands for a word boundery in grep’s extended regex. If you want to know more about how to use grep’s extended regex come to my talk at Penguicon 2015. http://2015.penguicon.org/ Remeber the best way to learn is by doing so go play, learn.


The Security Bit

Time:

The OpenBSD Foundation needs your help to achieve our fundraising goal of $200,000 for 2015.
http://www.openbsdfoundation.org/campaign2015.html

Donations to the foundation can be made on our Donations Page. We can be contacted regarding corporate sponsorship at fundraising@openbsdfoundation.org
http://www.openbsdfoundation.org/donations.html


Listener Feedback:

show (at) smlr.us or 734-258-7009
Time: 1:01:05


Outtro Music

Time: 1:06:05

Valentine by Rouletabille
https://www.jamendo.com/en/track/19297/valentine

This content is published under the Attribution-Noncommercial-Share Alike 3.0 Unported license.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Copyright © 2011-2023 Sunday Morning Linux Review All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.