smithj 05/07/11 22:42:33 Added: xml/htdocs/doc/en/articles lpi-101-administration-p2.xml Log: #97718: added LPI certification 101 Part 2 to articles
Revision Changes Path 1.1 xml/htdocs/doc/en/articles/lpi-101-administration-p2.xml file : http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/articles/lpi-101-administration-p2.xml?rev=1.1&content-type=text/x-cvsweb-markup&cvsroot=gentoo plain: http://www.gentoo.org/cgi-bin/viewcvs.cgi/xml/htdocs/doc/en/articles/lpi-101-administration-p2.xml?rev=1.1&content-type=text/plain&cvsroot=gentoo Index: lpi-101-administration-p2.xml =================================================================== <?xml version="1.0" encoding="UTF-8"?> <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/articles/lpi-101-administration-p2.xml,v 1.1 2005/07/11 22:42:33 smithj Exp $ --> <!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> <guide link="/doc/en/articles/lpi-101-administration-p2.xml"> <title>LPI certification 101 (release 2) exam prep, Part 2</title> <author title="Author"> <mail link="[EMAIL PROTECTED]">Daniel Robbins</mail> </author> <author title="Author"> <mail link="[EMAIL PROTECTED]">Chris Houser</mail> </author> <author title="Author"> Aron Griffis </author> <author title="Editor"> <mail link="[EMAIL PROTECTED]">Jonathan Smith</mail> </author> <abstract> In this tutorial, you will learn how to use regular expressions to search files for text patterns, how to locate files on your system, and how to take full control of Linux processes. You'll even get a whirlwind introduction to shell pipelines, redirection, and text processing commands. By the end of this tutorial, you'll have a solid grounding in basic Linux administration and will be ready to begin learning more advanced Linux system administration skills in the follow-on tutorial. </abstract> <!-- The original version of this article was published on IBM developerWorks, and is property of Westtech Information Services. This document is an updated version of the original article, and contains various improvements made by the Gentoo Linux Documentation team --> <version>1.0</version> <date>2005-07-11</date> <chapter> <title>Before You Start</title> <section> <title>About this tutorial</title> <body> <note> The original version of this article was published on IBM developerWorks, and is property of Westtech Information Services. This document is an updated version of the original article, and contains various improvements made by the Gentoo Linux Documentation team. </note> <p> Welcome to "Basic administration," the second of four tutorials designed to prepare you for the Linux Professional Institute's 101 exam. In this tutorial, we'll show you how to use regular expressions to search files for text patterns. Next, we'll introduce you to the Filesystem Hierarchy Standard (FSH), and then show you how to locate files on your system. Then, we'll show you how to take full control of Linux processes by running them in the background, listing processes, detaching processes from the terminal, and more. Next, we'll give you a whirlwind introduction to shell pipelines, redirection, and text processing commands. Finally, we'll introduce you to Linux kernel modules. </p> <p> This particular tutorial (Part 2) is ideal for those who have a good basic knowledge of bash and want to receive a solid introduction to basic Linux administration tasks. If you are new to Linux, we recommend that you complete Part 1 of this tutorial series first before continuing. For some, much of this material will be new, but more experienced Linux users may find this tutorial to be a great way of "rounding out" their basic Linux administration skills. </p> <p> For those who have taken the release 1 version of this tutorial for reasons other than LPI exam preparation, you probably don't need to take this one. However, if you do plan to take the exams, you should strongly consider reading this revised tutorial. </p> </body> </section> <section> <title>About the author</title> <body> <p> Residing in Albuquerque, New Mexico, Daniel Robbins is the Chief Architect of Gentoo Linux an advanced ports-based Linux meta distribution. He also writes articles, tutorials, and tips for the IBM developerWorks Linux zone and Intel Developer Services and has also served as a contributing author for several books, including Samba Unleashed and SuSE Linux Unleashed. Daniel enjoys spending time with his wife, Mary, and his daughter, Hadassah. You can contact Daniel at [EMAIL PROTECTED] </p> <p> Chris Houser, known to his friends as "Chouser," has been a UNIX proponent since 1994 when he joined the administration team for the computer science network at Taylor University in Indiana, where he earned his Bachelor's degree in Computer Science and Mathematics. Since then, he has gone on to work in Web application programming, user interface design, professional video software support, and now Tru64 UNIX device driver programming at Compaq. He has also contributed to various free software projects, most recently to Gentoo Linux). He lives with his wife and two cats in New Hampshire. You can contact Chris at [EMAIL PROTECTED] </p> <p> Aron Griffis graduated from Taylor University with a degree in Computer Science and an award that proclaimed, "Future Founder of a Utopian UNIX Commune." Working towards that goal, Aron is employed by Compaq writing network drivers for Tru64 UNIX, and spending his spare time plunking out tunes on the piano or developing Gentoo Linux. He lives with his wife Amy (also a UNIX engineer) in Nashua, New Hampshire. </p> </body> </section> </chapter> <chapter> <title>Regular Expressions</title> <section> <title>What is a regular expression?</title> <body> <p> A regular expression (also called a "regex" or "regexp") is a special syntax used to describe text patterns. On Linux systems, regular expressions are commonly used to find patterns of text, as well as to perform search-and-replace operations on text streams. </p> </body> </section> <section> <title>Glob comparison</title> <body> <p> As we take a look at regular expressions, you may find that regular expression syntax looks similar to the filename "globbing" syntax that we looked at in Part 1. However, don't let this fool you; their similarity is only skin deep. Both regular expressions and filename globbing patterns, while they may look similar, are fundamentally different beasts. </p> </body> </section> <section> <title>The simple substring</title> <body> <p> With that caution, let's take a look at the most basic of regular expressions, the simple substring. To do this, we're going to use <c>grep</c>, a command that scans the contents of a file for a particular regular expression. grep prints every line that matches the regular expression, and ignores every line that doesn't: </p> <pre caption="grep in action"> $ <i>grep bash /etc/passwd</i> operator:x:11:0:operator:/root:/bin/bash root:x:0:0::/root:/bin/bash ftp:x:40:1::/home/ftp:/bin/bash </pre> <p> Above, the first parameter to <c>grep</c> is a regex; the second is a filename. <c>grep</c> read each line in /etc/passwd and applied the simple substring regex bash to it, looking for a match. If a match was found, <c>grep</c> printed out the entire line; otherwise, the line was ignored. </p> </body> </section> <section> <title>Understanding the simple substring</title> <body> <p> In general, if you are searching for a substring, you can just specify the text verbatim without supplying any "special" characters. The only time you'd need to do anything special would be if your substring contained a +, ., *, [, ], or \, in which case these characters would need to be enclosed in quotes and preceded by a backslash. Here are a few more examples of simple substring regular expressions: </p> <ul> <li>/tmp (scans for the literal string /tmp)</li> <li>"\[box\]" (scans for the literal string [box])</li> <li>"\*funny\*" (scans for the literal string *funny*)</li> <li>"ld\.so" (scans for the literal string ld.so)</li> </ul> </body> </section> -- [email protected] mailing list
