⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 appendix-d.html

📁 linux-unix130.linux.and.unix.ebooks130 linux and unix ebookslinuxLearning Linux - Collection of 12 E
💻 HTML
📖 第 1 页 / 共 4 页
字号:
<HTML>

<HEAD>

<TITLE>Using Linux:APPENDIX D Top 50 Linux Commands and Utilities</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=0789716232//-->

<!--TITLE=Using Linux//-->

<!--AUTHOR=William Ball//-->

<!--PUBLISHER=Macmillan Computer Publishing//-->

<!--IMPRINT=Que//-->

<!--APPENDIX=D//-->

<!--PAGES=665-688//-->

<!--UNASSIGNED1//-->

<!--UNASSIGNED2//-->



<CENTER>

<TABLE BORDER>

<TR>

<TD><A HREF="ewtoc.html">Table of Contents</A></TD>

</TR>

</TABLE>

</CENTER>

<P><BR></P>

<H2><A NAME="Heading1"></A><FONT COLOR="#000077">APPENDIX D<BR>Top 50 Linux Commands and Utilities

</FONT></H2>

<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>

<P>Most of the descriptions also have examples with them. If these examples aren&#146;t self-evident, an explanation is provided. This is not an exhaustive list&#151;there are many more commands that you could use&#151;but these are the most common, and you will find yourself using them over and over again.</P>

<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&#151;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>

<DL>

<DD><B>1.</B>&nbsp;&nbsp;<TT>cat</TT>

<DD><B>2.</B>&nbsp;&nbsp;<TT>cd</TT>

<DD><B>3.</B>&nbsp;&nbsp;<TT>cp</TT>

<DD><B>4.</B>&nbsp;&nbsp;<TT>find</TT>

<DD><B>5.</B>&nbsp;&nbsp;<TT>grep</TT>

<DD><B>6.</B>&nbsp;&nbsp;<TT>ls</TT>

<DD><B>7.</B>&nbsp;&nbsp;<TT>more</TT>

<DD><B>8.</B>&nbsp;&nbsp;<TT>rm</TT>

<DD><B>9.</B>&nbsp;&nbsp;<TT>vi</TT>

<DD><B>10.</B>&nbsp;&nbsp;<TT>who</TT>

</DL>

<H3><A NAME="Heading2"></A><FONT COLOR="#000077">General Guidelines</FONT></H3>

<P>In general, if you want to change something that already exists, the command to do that will begin with <TT>ch</TT>. If you want to do something for the first time, the command to do that will usually begin with <TT>mk</TT>. If you want to undo something completely, the command will usually begin with <TT>rm</TT>. For example, to make a new directory, you use the <TT>mkdir</TT> command. To remove a directory, you use the <TT>rmdir</TT> command.</P>

<H3><A NAME="Heading3"></A><FONT COLOR="#000077">The List</FONT></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>

<H4 ALIGN="LEFT"><A NAME="Heading4"></A><FONT COLOR="#000077"><I>.</I>

</FONT></H4>

<P>The <TT>.</TT> command tells the shell to execute all the commands in the file that are passed an argument to the command. This works in the <TT>bash</TT> or <TT>pdksh</TT>. The equivalent in the <TT>tcsh</TT> is the <TT>source</TT> command. The following example will execute the command <TT>adobe</TT>:</P>

<!-- CODE SNIP //-->

<PRE>

. adobe

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading5"></A><FONT COLOR="#000077"><I>&</I>

</FONT></H4>

<P>The <TT>&</TT> 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 ALIGN="LEFT"><A NAME="Heading6"></A><FONT COLOR="#000077"><I>adduser</I>

</FONT></H4>

<P>The <TT>adduser</TT> command is used by root, or someone else who has the authority, to create a new user. The <TT>adduser</TT> command is followed by the account name to be created&#151;for example,</P>

<!-- CODE SNIP //-->

<PRE>

adduser dpitts

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading7"></A><FONT COLOR="#000077"><I>alias</I>

</FONT></H4>

<P>The <TT>alias</TT> 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 <TT>dir</TT> for a directory listing:</P>

<!-- CODE SNIP //-->

<PRE>

alias dir=ls

</PRE>

<!-- END CODE SNIP //-->

<P>Typing <TT>alias</TT> by itself will give you a list of all your current aliases. Such a list might look like this:</P>

<!-- CODE SNIP //-->

<PRE>

svr01:/home/dpitts$ alias

alias d=&#146;dir&#146;

alias dir=&#146;/bin/ls $LS_OPTIONS --format=vertical&#146;

alias ls=&#146;/bin/ls $LS_OPTIONS&#146;

alias v=&#146;vdir&#146;

alias vdir=&#146;/bin/ls $LS_OPTIONS --format=long&#146;

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading8"></A><FONT COLOR="#000077"><I>apropos &lt;parameter&gt;</I>

</FONT></H4>

<P>The <TT>apropos</TT> 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 <TT>man -k &lt;parameter&gt;</TT> command.</P>

<H4 ALIGN="LEFT"><A NAME="Heading9"></A><FONT COLOR="#000077"><I>banner</I>

</FONT></H4>

<P><TT>banner</TT> 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 <TT>$ banner hi</TT> to create the following banner:</P>

<!-- CODE //-->

<PRE>

          ##                                                  ###

          ##                                                  ###

          #######################################################

          #######################################################

          #######################################################

          #######################################################

          #######################################################

          ##                          ###

                                        ###

                                        ###

                                        ####

                                        ####

                                        ####

          ##                        #######

          ################################

          ################################

          ###############################

          ############################

          #########################

          ##

          ##                            ##

          ##                            ##          ####

          ################################        ########

          ################################        ########

          ################################        ########

          ################################         ######

          ################################          ####

          ##

</PRE>

<!-- END CODE //-->

<H4 ALIGN="LEFT"><A NAME="Heading10"></A><FONT COLOR="#000077"><I>bg</I>

</FONT></H4>

<P>The <TT>bg</TT> 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 <TT>&</TT> 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 <TT>bg</TT>. This then frees up your shell to allow you to execute other commands.</P>

<H4 ALIGN="LEFT"><A NAME="Heading11"></A><FONT COLOR="#000077"><I>bind</I>

</FONT></H4>

<P>Used in <TT>pdksh</TT>, the <TT>bind</TT> 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 (<TT>bsh</TT>). The syntax used for the command is</P>

<!-- CODE SNIP //-->

<PRE>

bind &lt;key  sequence&gt;  &lt;command&gt;

</PRE>

<!-- END CODE SNIP //-->

<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 ALIGN="LEFT"><A NAME="Heading12"></A><FONT COLOR="#000077"><I>cat</I>

</FONT></H4>

<P><TT>cat</TT> 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 <TT>cat</TT> command requires something to display and would have the following format:</P>

<!-- CODE SNIP //-->

<PRE>

cat &lt;filename&gt;

</PRE>

<!-- END CODE SNIP //-->

<H4 ALIGN="LEFT"><A NAME="Heading13"></A><FONT COLOR="#000077"><I>cd</I>

</FONT></H4>

<P><TT>cd</TT> stands for change directory. You will find this command extremely useful. There are three typical ways of using this command:</P>

<TABLE WIDTH="100%"><TR>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -