LightNovesOnl.com

LPI Linux Certification in a Nutshell Part 22

LPI Linux Certification in a Nutshell - LightNovelsOnl.com

You're reading novel online at LightNovelsOnl.com. Please use the follow button to get notifications about your favorite novels and its latest chapters so you can come back anytime and won't miss anything.

<> Match word boundaries. Word boundaries are defined as whites.p.a.ce, start of a line, end of a line, or punctuation marks. The backslashes are required and enable this interpretation of < and="" and=""> >.

Character sets The operators in Table10-8 Table10-8 match text. match text.

Table10-8.Regular expression character sets

Regular expression Description [abc][a-z]

Match any single character from among listed characters (abc) or from among the characters comprising a range (az).

[^abc][^a-z]

Match any single character not among listed characters or ranges.

Match any single character except a newline.

Modifiers The operators in Table10-9 Table10-9 modify the way other operators are interpreted. modify the way other operators are interpreted.

Table10-9.Regular expression modifiers

Basic regular expression Extended regular expression Description *

Match zero or more of the character that precedes it.

Match zero or one instance of the preceding regex.

+ + Match one or more instances of the preceding regex.

{n,m} {n,m} Match a range of occurrences of the single character or regex that precedes this construct. {n} matches matches n n occurrences, occurrences, { {n,} matches at least matches at least n n occurrences, and occurrences, and { {n,m} matches any number of occurrences between matches any number of occurrences between n n and and m m, inclusively.

| | Match the character or expression to the left or right of the vertical bar.

(regex) (regex) Matches regex, but it can be modified as a whole and used in back-references. (1 expands to the contents of the first expands to the contents of the first () () and so on up to and so on up to 9 9.)

Commands Many commands support the regular expression syntax, but the most commonly used is the command grep grep, which is designed to display lines from a file or files matching a given regular expression.

There are multiple ways to call grep grep to change its behavior: to change its behavior:grepTreat the pattern as a basic regular expression.egrepTreat the pattern as an extended regular expression. Same as grep E grep E.fgrepTreat the pattern as a list of fixed strings, any of which may be matched. Same as grep F grep F.

Objective 103.8: Perform Basic File Editing Operations Using vi Subcommands Start vi vi with with vi vi file1 file1 [ [file2 [...]] [...]]. See Table10-10 Table10-10.

Table10-10.Basic vi editing commands

Command Description Esc Exit insert mode and put the editor into command mode.

h or or left arrow left arrow Move left one character.

j or or down arrow down arrow Move down one line.

k or or up arrow up arrow Move up one line.

l or or right arrow right arrow Move right one character.

H Move to the top of the screen.

L Move to the bottom of the screen.

G Move to the end of the file.

W Move forward one word.

B Move backward one word.

0 (zero) (zero) Move to the beginning of the current line.

^ Move to the first nonwhites.p.a.ce character on the current line.

$ Move to the end of the current line.

Ctrl-B Move up (back) one screen.

Ctrl-F Move down (forward) one screen.

i Insert at the current cursor position.

I Insert at the beginning of the current line.

a Append after the current cursor position.

A Append to the end of the current line.

o Start a new line after the current line.

O Start a new line before the current line.

r Replace the character at the current cursor position.

R Start replacing (overwriting) at the current cursor position.

x Delete the character at the current cursor position.

X Delete the character immediately before (to the left) of the current cursor position.

s Delete the character at the current cursor position and go into insert mode. (This is the equivalent of the combination xi.) S Delete the contents of the current line and go into insert mode.

dX Given a movement command X, cut (delete) the appropriate number of characters, words, or lines from the current cursor position.

dd Cut the entire current line.

D Cut from the current cursor position to the end of the line. (This is equivalent to d$.) cX Given a movement command X, cut the appropriate number of characters, words, or lines from the current cursor position and go into insert mode.

cc Cut the entire current line and go into insert mode.

C Cut from the current cursor position to the end of the line and enter insert mode. (This is equivalent to c$.) yX Given a movement command X, copy (yank) the appropriate number of characters, words, or lines from the current cursor position.

yy or or Y Y Copy the entire current line.

p Paste after the current cursor position.

P Paste before the current cursor position.

Repeat the last command.

u Undo the last command.

/regex Search forward for regex.

?regex Search backward for regex.

n Find the next match.

N Find the previous match. (In other words, repeat the last search in the opposite direction.) :n Next file; when multiple files are specified for editing, this command loads the next file. Force this action (if the current file has unsaved changes) with :n!.

:e file Load file in place of the current file. Force this action with in place of the current file. Force this action with :e! :e! file file.

:r file Insert the contents of file after the current cursor position. after the current cursor position.

:q Quit without saving changes. Force this action with :q!.

:w file Write the current buffer to file. To append to an existing file, use :w >> :w >>file. Force the write (when possible, such as when running as root) with :w! :w! file file.

:wq Write the file contents and quit. Force this action with :wq!.

:x Write the file contents (if changed) and quit (the ex equivalent of equivalent of ZZ ZZ).

ZZ Write the file contents (if changed) and quit.

:! command Execute command in a subsh.e.l.l. in a subsh.e.l.l.

Devices, Linux Filesystems, and the Filesystem Hierarchy Standard Objective 104.1: Create Part.i.tions and Filesystems Disk drives and part.i.tions IDE disks are known as /dev/hda /dev/hda, /dev/hdb /dev/hdb, /dev/hdc /dev/hdc, /dev/hdd /dev/hdd, and so on.

Any disks using the SCSI emulation layer are known as /dev/sda /dev/sda, /dev/sdb /dev/sdb, /dev/sdc /dev/sdc, and so on. These include SCSI disks, SATA disks, and, in newer kernels, IDE disks.

Three types of part.i.tions:PrimaryFilesystem container. At least one must exist, and up to four can exist on a single physical disk. They are identified with numbers 1 to 4, such as /dev/hda1 /dev/hda1, /dev/hda2 /dev/hda2, and so on.ExtendedA variant of a primary part.i.tion, but it cannot contain a filesystem. Instead, it contains one or more logical part.i.tions logical part.i.tions. Only one extended part.i.tion may exist, and it takes one of the four possible spots for primary part.i.tions.LogicalCreated within within the extended part.i.tion. From 1 to 12 logical part.i.tions may be created. They are numbered from 5 to 16, such as the extended part.i.tion. From 1 to 12 logical part.i.tions may be created. They are numbered from 5 to 16, such as /dev/hda5 /dev/hda5, /dev/hda6 /dev/hda6, and so on.

Up to 15 part.i.tions with filesystems may exist on a single physical disk.

Filesystems The Linux kernel supports many different kinds of filesystems:ext3The third extended filesystem. A journaling filesystem, this has been the default for most Linux distributions since the early 2000s.ext2The second extended filesystem. This was the initial default Linux filesystem. ext3 ext3 is basically is basically ext2 ext2 with journaling support. with journaling support.xfsJournaling filesystem created by Silicon Graphics for IRIX and ported to Linux.reiserfsThis was the first journaling filesystem introduced in the standard Linux kernel.vfatA Microsoft Windows filesystem for Windows 95, 98, and ME systems.

The root filesystem and mount points The top of the filesystem tree is occupied by the root filesystem root filesystem. Other filesystems are mounted under it, creating a unified filesystem.

/etc, /lib /lib, /bin /bin, /sbin /sbin, and /dev /dev must be part of the root filesystem. must be part of the root filesystem.

Part.i.tion and filesystem management commands The following commands are commonly used to repair and manage filesystems: fdisk [device]

Manipulate or display the part.i.tion table for device device using a command-driven interactive text interface. using a command-driven interactive text interface. device device is a physical disk such as is a physical disk such as /dev/hda /dev/hda, not a part.i.tion such as /dev/hda1 /dev/hda1.

mkfs device device Make a filesystem on device device, which must be a part.i.tion.

mkswap device device Prepare a part.i.tion for use as swap s.p.a.ce.

Objective 104.2: Maintain the Integrity of Filesystems Filesystem commands df [directories]

Display overall disk utilization information for mounted filesystems on directories directories.

du [directories]

Display disk utilization information for directories directories.

Click Like and comment to support us!

RECENTLY UPDATED NOVELS

About LPI Linux Certification in a Nutshell Part 22 novel

You're reading LPI Linux Certification in a Nutshell by Author(s): Adam Haeder. This novel has been translated and updated at LightNovelsOnl.com and has already 955 views. And it would be great if you choose to read and follow your favorite novel on our website. We promise you that we'll bring you the latest novels, a novel list updates everyday and free. LightNovelsOnl.com is a very smart website for reading novels online, friendly on mobile. If you have any questions, please do not hesitate to contact us at [email protected] or just simply leave your comment so we'll know how to make you happy.