CompTIA Linux+ Powered by Linux Professional Institute Study Guide. Richard Blum
Чтение книги онлайн.
Читать онлайн книгу CompTIA Linux+ Powered by Linux Professional Institute Study Guide - Richard Blum страница 14
26. D. Typing lsmod (option D) produces a list of the modules that are currently loaded. The insmod
(option A) and modprobe
(option C) programs both load modules – either a single module or a single module and all those on which it depends, respectively. The depmod
command (option B) generates the modules.dep
file that contains module dependency information. The modinfo
command (option E) displays information, such as its version number and author, on a single module. For more information, see Chapter 3.
27. B, E. The chgrp
and chown
commands can both change the group ownership of a file. The chgrp
command takes a group name and a filename as parameters, as in option B. The chown
command normally changes a file's owner; but if you provide a group name preceded by a dot (.) or a colon (:), as in option E, it changes the group of a file. The chown
command as used in option A, will change the primary ownership of the file to the music
user, if such a user exists on the system; it won't change the group ownership. There is no standard chgroup
command, as in option C. Option D will change the permissions to 0600 (-rw–
), which will be a step backward with respect to the goal stated. For more information, see Chapter 4.
28. E. Hard links to directories are not permitted by most filesystems, so you'll probably have to create a symbolic link, as noted in option E. Links don't rely on a filesystem journal, so option A is incorrect. Contrary to option B, anybody may create a link, not just the original's owner. Option C describes a restriction of hard links, but because this link will probably have to be a symbolic link, this restriction is unimportant and option C is incorrect. Option D describes a more severe restriction than option B, but it's incorrect for the same reasons. For more information, see Chapter 4.
29. B, E. The colon (:
) starts ex mode, from which you can enter commands. In ex mode, r
includes a file in an existing one, w
writes a file, e
loads an entirely new file, and q
quits the program. Thus the desired combination is :wq
(option B). As a special case, ZZ
does the same thing, so option E is also correct. For more information, see Chapter 5.
30. C. The ∼/.forward
file is a user email forwarding file. The vertical bar character (|
) at the start of such a file is a code to send the email through the specified program file, so option C is correct. To do as option A describes, the file would need to read junkme
or junkme@
hostname, where hostname is the computer's hostname. To do as option B describes, the leading vertical bar would have to be omitted. It's conceivable that the ∼/junkme
script does as option D describes, but there's no way of knowing this for certain. To do as option E describes, the file would have to read user@junkme
, where user is the username. For more information, see Chapter 9.
Part I
Exam LX0-103
Chapter 1
Exploring Linux Command-Line Tools
THE FOLLOWING EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:
103.1 Work on the command line
103.2 Process text streams using filters
103.4 Use streams, pipes, and redirects
103.7 Search text files using regular expressions
Linux borrows heavily from Unix, and Unix began as a text-based operating system (OS). Unix and Linux retain much of this heritage, which means to understand how to use and, especially administer Linux, you must understand at least the basics of its command-line tools. Using command-line tools requires the use of a shell. A shell is a program that accepts and interprets text-mode commands and provides an interface to the system.
This chapter begins with basic shell information, including the various shell programs available and the procedures for using them. From there, this chapter covers streams, pipes, and redirection, which you can use to move input and output between programs or between files and programs. These techniques are frequently combined with text processing using filters– commands you can use to manipulate text without the help of a conventional text editor. Sometimes you must manipulate text in an abstract way, using codes to represent several different types of text. This chapter, therefore, covers this topic as well.
Understanding Command-Line Basics
Before you do anything else with Linux, you should understand how to use a Linux shell. The shell allows you to enter commands as needed. Which commands can be entered depends on which shell program is running. Several of the available shell programs are briefly described.
In using shell commands, you should also understand shell environment variables, which are placeholders for data that may be useful to many programs. Finally, it is helpful to know how to get help with the shell commands you're trying to use.
Exploring Your Linux Shell Options
The shell to be used for entering commands is configured for each individual user, and Linux provides a range of available shells. A complete shell list would be quite long, but the following shells are among the more common choices:
bash
The GNU Bourne Again Shell (bash
) is based on the earlier Bourne shell for Unix but extends it in several ways. In Linux, bash
is the most common default shell for user accounts, and it's the one emphasized in this book and on the exam.
Sh
The Bourne shell upon which bash
is based goes by the name sh
. It's not often used in Linux and the sh
command is often a pointer to the bash
shell or other shells.
tcsh
This shell is based on the earlier C shell (csh
). It's a fairly popular shell in some circles, but no major Linux distributions make it the default shell. Although it's similar to bash
in many respects, some operational details differ. For instance, you don't assign environment variables the same way in tcsh
as in bash
.
csh
The original C shell isn't used much on Linux, but if a user is familiar with csh
, tcsh
makes a good substitute.
ksh
The Korn shell (ksh
) was designed to take the best features of the Bourne shell and the C shell and extend them. It has a small but dedicated following among Linux users.
zsh
The Z shell (zsh
) takes shell evolution further than the Korn shell, incorporating features from earlier shells and adding still more.
In addition to these shells, dozens more obscure ones are available. In Linux, most users run bash
because it is the most popular shell. Some other OSs use csh
or tcsh
as the default, so if your