LINUX NEWS
Resources & Links From CramSession.com
Thursday, October 11, 2001
TABLE OF CONTENTS
1) Sean’s Notes
2) Linux News
Aussies say GPL is OK
Interview with Linus
Kernel 2.4.11 Released
StarOffice offers IT real choice
3) Linux Resources
Encrypted Filesystem Lab Notes
Opportunistic Encryption
PGP or GPG?
LPI Crash Course
Read and Write Excel Files in Perl
4) App o’ the week
~~~~~~~~~~~~~~~~~~~~~~ ADVERTISEMENT ~~~~~~~~~~~~~~~~~~~~~~~
XML is the wave of the Future. Make sure you’re ready to take advantage of the skills needed in today’s competitive market. FirstClass Systems offers superior XML training presented online with mentoring. Online Training is the most intelligent way to learn anything!
http://ad.brainbuzz.com/?RC06&AIA34
For information on how to advertise in this newsletter
please contact mailto:adsales@CramSession.com or visit
http://cramsession.com/marketing/default.asp
-------------------------
1) Sean's Notes
-------------------------
In previous articles I've used regular expressions to
perform various tasks. You may remember them as a string of
punctuation that doesn't make any sense, but I hope that
after this week, you'll be able to use them in your work
with Linux.
A regular expression is nothing more than a pattern to be
matched. They're used everywhere, from "awk" to "zegrep",
and luckily are fairly consistent. They can be simple or
complex, it's up to you.
You've probably used a regular expression before without
even knowing it:
$ ps -ef | egrep sendmail
can be used to see if sendmail is running. In this case,
"sendmail" is the regexp, and is the simplest form of all,
matching the string "sendmail" itself. Thus, the following
will match...
sendmail
aaaasendmailzzzz
...but the following will not:
Sendmail
send mail
banana
In the first case, "sendmail" by itself matches the given
string of "sendmail". The second string contains "sendmail"
within it, still valid. However, being very literal,
"Sendmail" with a capital 'S' does not equal "sendmail", nor
does "send mail" (space). Of course, banana isn't even close.
Now, suppose you wanted to match "sendmail", with or without
a capital 'S'. We could construct two separate commands,
each with one variation, or we could make use of square
brackets : \[]. Square brackets mean "one of the characters
inside is OK":
$ ps -ef | egrep '\[sS]endmail'
This time, I protected our string with quotes because some
shells might start interpreting the special characters.
Looking at the regexp, it will match a string that starts
with either 's' or 'S', followed by "endmail".
What if we're looking for a string, but are not sure of a
letter? For example, you're doing a crossword puzzle, and
need a five letter word that starts with "tr", and ends with
"ck". In this case, the period has meaning in that it
matches any single character:
$ egrep 'tr.ck' /usr/dict/words
If you run that command, you'll probably get a whole list of
words, because egrep will look for substring matches if we
don't tell it otherwise.
To fix this one up, the ^ and $ characters are employed.
^ matches the beginning of a line, and $ the end of a line.
Since /usr/dict/words has one word per line, we can use:
$ egrep '^tr.ck$' /usr/dict/words
which means "find a line that begins with tr, has any
character followed by ck". My search returned:
track
trick
truck
Two more characters will really demonstrate the power of
regular expressions: \* and +. \* means "zero or more of the
previous", while + means "one or more of the previous"
The regexp 'hi\*' will match "h", "hi", "hii" and so on, but
'hi+' will match only the latter two because of the
requirement for one i. + and \* may be combined with other
operators, such as .\*, which means "anything".
Let's say you were trying to find the spelling of
"acquiescent" out of /usr/dict/words. You knew it ends
with ent, so we'll craft our regexp starting there:
$ egrep 'ent$' /usr/dict/words
457 words on my machine, so we'll have to be a bit more
specific.
Knowing it starts with "a" doesn't help a lot, only
bringing it down to 71.
$ egrep '^a.+ent$' /usr/dict/words
I know it's got a q in there, but is it "acq" or "aq"?
$ egrep '^ac?q.+ent$' /usr/dict/words
acquiescent
Our final regexp refers to a string that begins with a, may
have a c, then has a q followed by an indeterminate number
of letters, but ending in ent.
One final aspect of regexps I'll explain today is similar to
the square brackets, but refer to strings. To check on the
status of nfs, I want to make sure nfsd, portmap and
rpc.mountd are running. I could run...
$ ps -ef | egrep nfsd
$ ps -ef | egrep mountd
$ ps -ef | egrep portmap
...but I'd rather run them as one command. Parenthesis ()
and the | "or" operator mean that multiple strings can match:
$ ps -ef | egrep '(nfsd|mountd|portmap)'
will match any line that has either of the strings "nfsd" or
"mountd" (or both, for that matter).
Before I sign off, a common trick in shell scripts uses the
\[] operators to correct a common flaw. When I type:
$ ps -ef | egrep sendmail
I end up with:
...... sendmail: accepting connections
...... egrep sendmail
What's that "egrep sendmail" doing in there? According to
Unix, it's to pump the output of ps -ef into the input of
egrep. In order to do so, it has to create the egrep process,
which contains the "sendmail" string. To prevent this,
$ ps -ef | egrep '\[s]endmail'
As we learned above, the \[] operator means "anything inside",
which can only be an 's' in this case. "sendmail" does not
match "\[s]endmail" (which is how would appear in the process
entry for egrep), so only bona fide sendmail processes are
shown.
So that's regexp in a nutshell. There are a lot more
operators, especially once you get into the perl
implementation of it. However, a basic understanding of
regexps will help you in your shell scripting, not to mention
shaving off a lot of keystrokes when doing your regular work.
Long live the Penguin,
Sean
swalberg@cramsession.com
Visit the Linux News Board at
http://boards.brainbuzz.com/boards/vbt.asp?b2
-------------------------
2) Linux News
-------------------------
---------------------
Aussies say GPL is OK
---------------------
This report looks at the validity of Craig Mundie's "GPL is
Evil" speeches from an Australian standpoint. I'm sure you
won't be surprised at the results, but it's still a good
read.
http://australianit.news.com.au/articles/0,7204,2774764%5E15306%5E%
5Enbv%5E,00.html
--------------------
Interview with Linus
--------------------
Interviews with Linus are usually pretty good reading. In
this one, he talks a bit about what's on tap for 2.5/2.6,
and gives his take on the "GNU/Linux" vs "Linux" naming
debate. His answer to the latter question is always good
for a chuckle; this time is no exception.
http://www.osnews.com/story.php?news_id1
----------------------
Kernel 2.4.11 Released
----------------------
Once again, we've got a new kernel. Nothing too exciting,
just a lot of driver fixes. An interesting note in the
ChangeLog about a fix for x86 boxes with more than 8 CPUs,
so if you're in that lucky few, this one will be of special
interest.
http://www.kernel.org/pub/linux/kernel/v2.4/ChangeLog-2.4.11
--------------------------------
StarOffice offers IT real choice
--------------------------------
As I mentioned last week, StarOffice 6.0 beta was released,
and already I'm happy with it. It would appear that ZDNet is
also looking at it in a favourable light, even making
comparisons to Word. If you haven't had the chance to try out
StarOffice, give this article a read, then follow the links
to download a free office suite.
http://www.zdnet.com/products/stories/reviews/0,4161,2816213,00.htm
l
-------------------------
3) Linux Resources
-------------------------
------------------------------
Encrypted Filesystem Lab Notes
------------------------------
With the modular nature of Unix, adding a layer of encryption
on top of your filesystem isn't very hard. This set of notes
should be able to guide you through the process of keeping
your data protected.
http://www.zen-data.com/labnotes/lab002.html
------------------------
Opportunistic Encryption
------------------------
One of the original goals of the Free S/WAN project was to
create an implementation of IPSEC that can build tunnels on
demand, such that users don't even know their traffic is
protected. This summer, the goal was achieved in part, and
this document explains how to set up this very important
feature.
http://www.freeswan.org/freeswan_trees/freeswan-1.91/doc/opportunis
m.howto
-----------
PGP or GPG?
-----------
I've been a longtime user of PGP to secure my email, but
recently I've been meaning to make the switch to the Free
implementation, GPG. Since most of my friends use PGP, I
knew I'd run into some trouble, but luckily, this document
helped set me straight.
http://technocage.com/~caskey/gnupg/pgp2gnupg.html
----------------
LPI Crash Course
----------------
For those of you looking to challenge the LPI Linux
certification, O'Reilly has kindly made available a crash
course in the topic. Reading through, it's just as valid
for other Linux certifications, so keep this one handy
when you're studying.
http://linux.oreilly.com/news/lpilinux_0601.html
----------------------------------
Read and Write Excel Files in Perl
----------------------------------
Spreadsheet::WriteExcel and Spreadsheet::ParseExcel are two
Perl modules that allow you to read and write Excel files
from within Perl. This article explains the modules
themselves, and how to use them.
http://www-106.ibm.com/developerworks/linux/library/l-pexcel/
-------------------------
4) App o' the week
-------------------------
RADIUS is a common service to offer to keep track of users
and privileges. Routers and access servers can query a central
server, which greatly increases management. The FreeRADIUS
project is an improvement on the traditional Livingstone
RADIUS server, but with a whole whack of features not seen
in other implementations.
http://www.freeradius.org/
-------------------------
(C) 2001 BrainBuzz.com, Inc. All Rights Reserved.
-------------------------
-------------------------
This message is from CramSession.com.
You are currently subscribed to the
Hottest Linux News and Resources
as: sean@ertw.com
To un-subscribe from this newsletter by e-mail:
send a blank email message to:
mailto:leave-linuxnews-3825955Y@list.cramsession.com
-------------------------------------------------------
To Subscribe to this newsletter by e-mail:
send a blank email message to:
mailto:join-linuxnews@list.cramsession.com
-------------------------