📄 appendix-b.html
字号:
<HTML>
<HEAD>
<TITLE>Developer.com - Online Reference Library - 0672311739:RED HAT LINUX 2ND EDITION:appendix-b</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
<SCRIPT>
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=1,scrollbars=yes');
}
//-->
</SCRIPT>
</HEAD>
-->
<!-- ISBN=0672311739 //-->
<!-- TITLE=RED HAT LINUX 2ND EDITION //-->
<!-- AUTHOR=DAVID PITTS ET AL //-->
<!-- PUBLISHER=MACMILLAN //-->
<!-- IMPRINT=SAMS PUBLISHING //-->
<!-- PUBLICATION DATE=1998 //-->
<!-- CHAPTER=appendix-b //-->
<!-- PAGES=611-628 //-->
<!-- UNASSIGNED1 //-->
<!-- UNASSIGNED2 //-->
<P><CENTER>
<a href="ewtoc.html">Table of Contents</A>
</CENTER></P>
<HTML>
<HEAD>
<TITLE>developer.com - Reference Library</TITLE>
<A NAME="PAGENUM-611"><P>Page 611</P></A>
<H3>
APPENDIX B<BR>
</H3>
<H2>
Top 50 Linux <BR>
Commands and <BR>
Utilities
</H2>
<P><B>by David Pitts
</P></B>
<H3><A NAME="1739_ 13">
IN THIS APPENDIX
</A></H3>
<UL>
<LI>General Guidelines 612
<LI>The List 612
</UL>
<A NAME="PAGENUM-612"><P>Page 612</P></A>
<P>This appendix is not meant to replace the man pages; it does not go into anything
resembling the detail available in the man pages. This appendix is designed to give you a feel for the
commands and a brief description as to what they do. In most cases there are more parameters
that can be used than are shown here.
<P>Most of the descriptions also have examples with them. If these examples aren't
self-evident, an explanation is provided. This is not an exhaustive list—there are many more
commands that you could use—but these are the most common, and you will find yourself using
them over and over again.
<P>To keep things simple, the commands are listed in alphabetical order. I would have
preferred to put them in order of how often I use them, but that would make locating them quite
difficult. However, I do want to summarize by listing what are, at least for me, the ten most
common commands—also alphabetically. This list of essential commands could be compared to
a list of the top ten words spoken by the cavemen when searching for food and a mate:
</P>
<OL>
<LI> cat
<LI> cd
<LI> cp
<LI> find
<LI> grep
<LI> ls
<LI> more
<LI> rm
<LI> vi
<LI> who
</OL>
<H3><A NAME="1739_ 14"><A NAME="JOIN-1">
General Guidelines
</A></H3>
<P>In general, if you want to change something that already exists, the command to do that
will begin with ch. If you want to do something for the first time, the command to do that
will usually begin with mk. If you want to undo something completely, the command will
usually begin with rm. For example, to make a new directory, you use the
mkdir command. To remove a directory, you use the
rmdir command.
</P>
<H3><A NAME="1739_ 15"><A NAME="JOIN-2">
The List
</A></H3>
<P>The commands listed in this appendix are some of the most common commands used in
Red Hat Linux. In cases where the command seems ambiguous, an example is provided. With
each of these commands, the man pages can provide additional information, as well as more
examples.
</P>
<A NAME="PAGENUM-613"><P>Page 613</P></A>
<H4><A NAME="1739_ 16">
.
</A></H4>
<P>The . command tells the shell to execute all the commands in the file that are passed an
argument to the command. This works in the bash or
pdksh. The equivalent in the tcsh is the source command. The following example will execute the command
adobe:
</P>
<!-- CODE SNIP //-->
<PRE>
. adobe
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="1739_ 17">
&
</A></H4>
<P>The & after any other command tells the computer to run the command in the background.
By placing a job in the background, the user can then continue using that shell to process
other commands. If the command is run in the foreground, the user cannot continue using that
shell until the process finishes.
</P>
<H4><A NAME="1739_ 18">
adduser
</A></H4>
<P>The adduser command is used by root, or someone else who has the authority, to create a
new user. The adduser command is followed by the account name to be created—for example,
</P>
<!-- CODE SNIP //-->
<PRE>
adduser dpitts
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="1739_ 19">
alias
</A></H4>
<P>The alias command is used to make aliases or alternative names for commands.
Typically, these aliases are abbreviations of the actual command. In the following example, the user
(probably a DOS user) is adding an alias of dir for a directory listing:
</P>
<!-- CODE SNIP //-->
<PRE>
alias dir=ls
</PRE>
<!-- END CODE SNIP //-->
<P>Typing alias by itself will give you a list of all your current aliases. Such a list might look
like this:
</P>
<!-- CODE //-->
<PRE>
svr01:/home/dpitts$ alias
alias d='dir'
alias dir='/bin/ls $LS_OPTIONS --format=vertical'
alias ls='/bin/ls $LS_OPTIONS'
alias v='vdir'
alias vdir='/bin/ls $LS_OPTIONS --format=long'
</PRE>
<!-- END CODE //-->
<H4><A NAME="1739_ 20">
apropos <<B><I>parameter</I></B>>
</A></H4>
<P>The apropos command literally means appropriate or regarding (others). When it is
followed by a parameter, it will search the man pages for entries that include the parameter.
Basically, this performs a keyword search on all the man pages. This is the equivalent
of the man -k <BR>
<parameter> command.
</P>
<A NAME="PAGENUM-614"><P>Page 614</P></A>
<H4><A NAME="1739_ 21">
banner
</A></H4>
<P>banner prints a large, high-quality banner to standard output. If the message is omitted,
it prompts for and reads one line from standard input. For example, enter
$ banner hi to create the following banner:
</P>
<!-- CODE //-->
<PRE>
## ###
## ###
#######################################################
#######################################################
#######################################################
#######################################################
#######################################################
## ###
###
###
####
####
####
## #######
################################
################################
###############################
############################
#########################
##
## ##
## ## ####
################################ ########
################################ ########
################################ ########
################################ ######
################################ ####
##
</PRE>
<!-- END CODE //-->
<H4><A NAME="1739_ 22">
bg
</A></H4>
<P>The bg command is used to force a suspended process to run in the background. For
example, you might have started a command in the foreground (without using
& after the command), and realized that it was going to take a while, but that you still needed your shell. You
could take that process that is currently running and hold down the Ctrl key, and, while it is
held down, press the Z key. This places the current process on hold. You can either leave it on
hold, just as if you called your telephone company, or you could place that process in the
background by typing bg. This then frees up your shell to allow you to execute other commands.
</P>
<H4><A NAME="1739_ 23">
bind
</A></H4>
<P>Used in pdksh, the bind command enables the user to change the behavior of key
combinations for the purpose of command-line editing. Many times people bind the up, down,
left, and right arrow keys so that they work the way they would in the Bourne Again Shell
(bsh). The syntax used for the command is
</P>
<!-- CODE SNIP //-->
<PRE>
bind <key sequence> <command>
</PRE>
<!-- END CODE SNIP //-->
<A NAME="PAGENUM-615"><P>Page 615</P></A>
<P>The following examples are the bind commands to create bindings for scrolling up and
down the history list and for moving left and right along the command line:
</P>
<!-- CODE SNIP //-->
<PRE>
bind `^[[`=prefix-2
bind `^XA`=up-history
bind `^XB`=down-history
bind `^XC`=forward-char
bind `^XD`=backward-char
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="1739_ 24">
cat
</A></H4>
<P>cat does not call your favorite feline; instead, it tells the contents of (typically) the file to
scroll its contents across the screen. If that file happens to be binary, then the cat gets a hairball
and shows it to you on the screen. Typically, this is a noisy process as well. What is actually
happening is that the cat command is scrolling the characters of the file, and the terminal is
doing all it can to interpret and display the data in the file. This interpretation can include the
character used to create the bell signal, which is where the noise comes from. As you might
have surmised, the cat command requires something to display and would have the
following format:
</P>
<!-- CODE SNIP //-->
<PRE>
cat <filename>
</PRE>
<!-- END CODE SNIP //-->
<H4><A NAME="1739_ 25">
cd
</A></H4>
<P>cd stands for change directory. You will find this command extremely useful. There are
three typical ways of using this command:
</P>
<BR>
<TABLE WIDTH="360">
<TR><TD>
cd ..
</TD><TD>
Moves one directory up the directory tree.
</TD></TR>
<TR><TD>
cd ~
</TD><TD>
Moves to your home directory from wherever you
currently are. This is the same as issuing cd by itself.
</TD></TR>
<TR><TD>
cd directory name
</TD><TD>
Changes to a specific directory. This can be a
directory relative to your current location
or can be based on the root directory by
placing a forward slash (/) before the directory name.
These examples can be combined. For example,
suppose
you were in the directory /home/dsp1234 and you
wanted
to go to tng4321's home account. You could perform
the following command, which will move you back up
the directory one level and then move you down into
the
tng4321 directory:
cd ../tng4321
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -