Gentoo Archives: gentoo-doc-cvs

From: Jonathan Smith <smithj@×××××××××××.org>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] cvs commit: lpi-101-administration-p2.xml
Date: Mon, 11 Jul 2005 22:42:49
Message-Id: 200507112241.j6BMfpw8016436@robin.gentoo.org
1 smithj 05/07/11 22:42:33
2
3 Added: xml/htdocs/doc/en/articles lpi-101-administration-p2.xml
4 Log:
5 #97718: added LPI certification 101 Part 2 to articles
6
7 Revision Changes Path
8 1.1 xml/htdocs/doc/en/articles/lpi-101-administration-p2.xml
9
10 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
11 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
12
13 Index: lpi-101-administration-p2.xml
14 ===================================================================
15 <?xml version="1.0" encoding="UTF-8"?>
16 <!-- $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 $ -->
17 <!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
18
19 <guide link="/doc/en/articles/lpi-101-administration-p2.xml">
20 <title>LPI certification 101 (release 2) exam prep, Part 2</title>
21
22 <author title="Author">
23 <mail link="drobbins@g.o">Daniel Robbins</mail>
24 </author>
25 <author title="Author">
26 <mail link="chouser@g.o">Chris Houser</mail>
27 </author>
28 <author title="Author">
29 Aron Griffis
30 </author>
31 <author title="Editor">
32 <mail link="smithj@g.o">Jonathan Smith</mail>
33 </author>
34
35 <abstract>
36 In this tutorial, you will learn how to use regular expressions to search files
37 for text patterns, how to locate files on your system, and how to take full
38 control of Linux processes. You'll even get a whirlwind introduction to shell
39 pipelines, redirection, and text processing commands. By the end of this
40 tutorial, you'll have a solid grounding in basic Linux administration and will
41 be ready to begin learning more advanced Linux system administration skills in
42 the follow-on tutorial.
43 </abstract>
44
45 <!-- The original version of this article was published on IBM developerWorks,
46 and is property of Westtech Information Services. This document is an updated
47 version of the original article, and contains various improvements made by the
48 Gentoo Linux Documentation team -->
49
50 <version>1.0</version>
51 <date>2005-07-11</date>
52
53 <chapter>
54 <title>Before You Start</title>
55 <section>
56 <title>About this tutorial</title>
57 <body>
58
59 <note>
60 The original version of this article was published on IBM developerWorks, and
61 is property of Westtech Information Services. This document is an updated
62 version of the original article, and contains various improvements made by the
63 Gentoo Linux Documentation team.
64 </note>
65
66 <p>
67 Welcome to "Basic administration," the second of four tutorials designed to
68 prepare you for the Linux Professional Institute's 101 exam. In this tutorial,
69 we'll show you how to use regular expressions to search files for text
70 patterns. Next, we'll introduce you to the Filesystem Hierarchy Standard (FSH),
71 and then show you how to locate files on your system. Then, we'll show you how
72 to take full control of Linux processes by running them in the background,
73 listing processes, detaching processes from the terminal, and more. Next, we'll
74 give you a whirlwind introduction to shell pipelines, redirection, and text
75 processing commands. Finally, we'll introduce you to Linux kernel modules.
76 </p>
77
78 <p>
79 This particular tutorial (Part 2) is ideal for those who have a good basic
80 knowledge of bash and want to receive a solid introduction to basic Linux
81 administration tasks. If you are new to Linux, we recommend that you complete
82 Part 1 of this tutorial series first before continuing. For some, much of this
83 material will be new, but more experienced Linux users may find this tutorial
84 to be a great way of "rounding out" their basic Linux administration skills.
85 </p>
86
87 <p>
88 For those who have taken the release 1 version of this tutorial for reasons
89 other than LPI exam preparation, you probably don't need to take this one.
90 However, if you do plan to take the exams, you should strongly consider reading
91 this revised tutorial.
92 </p>
93
94 </body>
95 </section>
96 <section>
97 <title>About the author</title>
98 <body>
99
100 <p>
101 Residing in Albuquerque, New Mexico, Daniel Robbins is the Chief Architect of
102 Gentoo Linux an advanced ports-based Linux meta distribution. He also writes
103 articles, tutorials, and tips for the IBM developerWorks Linux zone and Intel
104 Developer Services and has also served as a contributing author for several
105 books, including Samba Unleashed and SuSE Linux Unleashed. Daniel enjoys
106 spending time with his wife, Mary, and his daughter, Hadassah. You can contact
107 Daniel at drobbins@g.o.
108 </p>
109
110 <p>
111 Chris Houser, known to his friends as "Chouser," has been a UNIX proponent
112 since 1994 when he joined the administration team for the computer science
113 network at Taylor University in Indiana, where he earned his Bachelor's degree
114 in Computer Science and Mathematics. Since then, he has gone on to work in Web
115 application programming, user interface design, professional video software
116 support, and now Tru64 UNIX device driver programming at Compaq. He has also
117 contributed to various free software projects, most recently to Gentoo Linux).
118 He lives with his wife and two cats in New Hampshire. You can contact Chris at
119 chouser@g.o.
120 </p>
121
122 <p>
123 Aron Griffis graduated from Taylor University with a degree in Computer Science
124 and an award that proclaimed, "Future Founder of a Utopian UNIX Commune."
125 Working towards that goal, Aron is employed by Compaq writing network drivers
126 for Tru64 UNIX, and spending his spare time plunking out tunes on the piano or
127 developing Gentoo Linux. He lives with his wife Amy (also a UNIX engineer) in
128 Nashua, New Hampshire.
129 </p>
130
131 </body>
132 </section>
133 </chapter>
134
135 <chapter>
136 <title>Regular Expressions</title>
137 <section>
138 <title>What is a regular expression?</title>
139 <body>
140
141 <p>
142 A regular expression (also called a "regex" or "regexp") is a special syntax
143 used to describe text patterns. On Linux systems, regular expressions are
144 commonly used to find patterns of text, as well as to perform
145 search-and-replace operations on text streams.
146 </p>
147
148 </body>
149 </section>
150 <section>
151 <title>Glob comparison</title>
152 <body>
153
154 <p>
155 As we take a look at regular expressions, you may find that regular expression
156 syntax looks similar to the filename "globbing" syntax that we looked at in
157 Part 1. However, don't let this fool you; their similarity is only skin deep.
158 Both regular expressions and filename globbing patterns, while they may look
159 similar, are fundamentally different beasts.
160 </p>
161
162 </body>
163 </section>
164 <section>
165 <title>The simple substring</title>
166 <body>
167
168 <p>
169 With that caution, let's take a look at the most basic of regular expressions,
170 the simple substring. To do this, we're going to use <c>grep</c>, a command
171 that scans the contents of a file for a particular regular expression. grep
172 prints every line that matches the regular expression, and ignores every line
173 that doesn't:
174 </p>
175
176 <pre caption="grep in action">
177 $ <i>grep bash /etc/passwd</i>
178 operator:x:11:0:operator:/root:/bin/bash
179 root:x:0:0::/root:/bin/bash
180 ftp:x:40:1::/home/ftp:/bin/bash
181 </pre>
182
183 <p>
184 Above, the first parameter to <c>grep</c> is a regex; the second is a filename.
185 <c>grep</c> read each line in /etc/passwd and applied the simple substring
186 regex bash to it, looking for a match. If a match was found, <c>grep</c>
187 printed out the entire line; otherwise, the line was ignored.
188 </p>
189
190 </body>
191 </section>
192 <section>
193 <title>Understanding the simple substring</title>
194 <body>
195
196 <p>
197 In general, if you are searching for a substring, you can just specify the text
198 verbatim without supplying any "special" characters. The only time you'd need
199 to do anything special would be if your substring contained a +, ., *, [, ], or
200 \, in which case these characters would need to be enclosed in quotes and
201 preceded by a backslash. Here are a few more examples of simple substring
202 regular expressions:
203 </p>
204
205 <ul>
206 <li>/tmp (scans for the literal string /tmp)</li>
207 <li>"\[box\]" (scans for the literal string [box])</li>
208 <li>"\*funny\*" (scans for the literal string *funny*)</li>
209 <li>"ld\.so" (scans for the literal string ld.so)</li>
210 </ul>
211
212 </body>
213 </section>
214
215
216
217 --
218 gentoo-doc-cvs@g.o mailing list