📄 appendix-d.html
字号:
<H4 ALIGN="LEFT"><A NAME="Heading27"></A><FONT COLOR="#000077"><I>gzip</I>
</FONT></H4>
<P><TT>gzip</TT> is GNU’s version of the zip compression software. The syntax can be as simple as</P>
<!-- CODE SNIP //-->
<PRE>
gzip <filename>
</PRE>
<!-- END CODE SNIP //-->
<P>but many times also contains some parameters between the command and the filename to be compressed.
</P>
<H4 ALIGN="LEFT"><A NAME="Heading28"></A><FONT COLOR="#000077"><I>halt</I>
</FONT></H4>
<P>The <TT>halt</TT> command tells the kernel to shut down. This is a superuser-only command (you must “be root”).</P>
<H4 ALIGN="LEFT"><A NAME="Heading29"></A><FONT COLOR="#000077"><I>hostname</I>
</FONT></H4>
<P><TT>hostname</TT> is used to either display the current host or domain name of the system or to set the hostname of the system—for example,</P>
<!-- CODE SNIP //-->
<PRE>
svr01:/home/dpitts$ hostname
svr01
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading30"></A><FONT COLOR="#000077"><I>kill</I>
</FONT></H4>
<P><TT>kill</TT> sends the specified signal to the specified process. If no signal is specified, the <TT>TERM</TT> signal is sent. The <TT>TERM</TT> signal will kill processes that do not process the <TT>TERM</TT> signal. For processes that do process the <TT>TERM</TT> signal, it might be necessary to use the <TT>KILL</TT> signal because this signal cannot be caught. The syntax for the <TT>kill</TT> command is <TT>kill <option> <pid></TT>, and an example is as follows:</P>
<!-- CODE SNIP //-->
<PRE>
svr01:/home/dpitts$kill -9 1438
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading31"></A><FONT COLOR="#000077"><I>less</I>
</FONT></H4>
<P><TT>less</TT> is a program similar to <TT>more</TT>, but which allows backward movement in the file as well as forward movement. <TT>less</TT> also doesn’t have to read the entire input file before starting, so with large input files it starts up faster than text editors such as <TT>vi</TT>.</P>
<H4 ALIGN="LEFT"><A NAME="Heading32"></A><FONT COLOR="#000077"><I>login</I>
</FONT></H4>
<P><TT>login</TT> is used when signing on to a system. It can also be used to switch from one user to another at any time.</P>
<H4 ALIGN="LEFT"><A NAME="Heading33"></A><FONT COLOR="#000077"><I>logout</I>
</FONT></H4>
<P><TT>logout</TT> is used to sign off a system as the current user. If it is the only user you are logged in as, then you are logged off the system.</P>
<H4 ALIGN="LEFT"><A NAME="Heading34"></A><FONT COLOR="#000077"><I>lpc</I>
</FONT></H4>
<P><TT>lpc</TT> is used by the system administrator to control the operation of the line printer system. <TT>lpc</TT> can be used to disable or enable a printer or a printer’s spooling queue, to rearrange the order of jobs in a spooling queue, to find out the status of printers, to find out the status of the spooling queues, and to find out the status of the printer daemons. The command can be used for any of the printers configured in <TT>/etc/printcap</TT>.</P>
<H4 ALIGN="LEFT"><A NAME="Heading35"></A><FONT COLOR="#000077"><I>lpd</I>
</FONT></H4>
<P><TT>lpd</TT> is the line printer daemon and is normally invoked at boot time from the <TT>rc</TT> file. It makes a single pass through the <TT>/etc/printcap</TT> file to find out about the existing printers and prints any files left after a crash. It then uses the system calls <TT>listen</TT> and <TT>accept</TT> to receive requests to print files in the queue, transfer files to the spooling area, display the queue, or remove jobs from the queue.</P>
<H4 ALIGN="LEFT"><A NAME="Heading36"></A><FONT COLOR="#000077"><I>lpq</I>
</FONT></H4>
<P><TT>lpq</TT> examines the spooling area used by <TT>lpd</TT> for printing files on the line printer, and reports the status of the specified jobs or all jobs associated with a user. If the command is invoked without any arguments, the command reports on any jobs currently in the print queue.</P>
<H4 ALIGN="LEFT"><A NAME="Heading37"></A><FONT COLOR="#000077"><I>lpr</I>
</FONT></H4>
<P>The line printer command uses a spooling daemon to print the named files when facilities become available. If no names appear, the standard input is assumed. The following is an example of the <TT>lpr</TT> command:</P>
<!-- CODE SNIP //-->
<PRE>
lpr /etc/hosts
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading38"></A><FONT COLOR="#000077"><I>ls</I>
</FONT></H4>
<P>The <TT>ls</TT> command lists the contents of a directory. The format of the output is manipulated with options. The <TT>ls</TT> command, with no options, lists all nonhidden files (a file that begins with a dot is a hidden file) in alphabetical order, filling as many columns as will fit in the window. Probably the most common set of options used with this command is the <TT>-la</TT> option. The a means list all (including hidden files) files, and the l means make the output a long listing. Here is an example of this command:</P>
<!-- CODE //-->
<PRE>
svr01:~$ ls -la
total 35
drwxr-xr-x 7 dpitts users 1024 Jul 21 00:19 ./
drwxr-xr-x 140 root root 3072 Jul 23 14:38 ../
-rw-r--r-- 1 dpitts users 4541 Jul 23 23:33
.bash_history
-rw-r--r-- 1 dpitts users 18 Sep 16 1996 .
forward
-rw-r--r-- 2 dpitts users 136 May 10 01:46
.htaccess
-rw-r--r-- 1 dpitts users 164 Dec 30 1995 .kermrc
-rw-r--r-- 1 dpitts users 34 Jun 6 1993 .less
-rw-r--r-- 1 dpitts users 114 Nov 23 1993 .lessrc
-rw-r--r-- 1 dpitts users 10 Jul 20 22:32 .profile
drwxr-xr-x 2 dpitts users 1024 Dec 20 1995 .term/
drwx------ 2 dpitts users 1024 Jul 16 02:04 Mail/
drwxr-xr-x 2 dpitts users 1024 Feb 1 1996 cgi-
src/
-rw-r--r-- 1 dpitts users 1643 Jul 21 00:23 hi
-rwxr-xr-x 1 dpitts users 496 Jan 3 1997 nquota*
drwxr-xr-x 2 dpitts users 1024 Jan 3 1997 passwd/
drwxrwxrwx 5 dpitts users 1024 May 14 20:29
public_html/
</PRE>
<!-- END CODE //-->
<H4 ALIGN="LEFT"><A NAME="Heading39"></A><FONT COLOR="#000077"><I>make</I>
</FONT></H4>
<P>The purpose of the <TT>make</TT> utility is to automatically determine which pieces of a large program need to be recompiled and then to issue the commands necessary to recompile them.</P>
<H4 ALIGN="LEFT"><A NAME="Heading40"></A><FONT COLOR="#000077"><I>man</I>
</FONT></H4>
<P>The <TT>man</TT> command is used to format and display the online manual pages. The manual pages are the text that describes, in detail, how to use a specified command. In the following example, I have called the man page that describes the <TT>man</TT> pages:</P>
<!-- CODE //-->
<PRE>
svr01:~$ man man
man(1) man(1)
NAME
man - format and display the on-line manual pages
manpath - determine user’s search path for man pages
SYNOPSIS
man [-adfhktwW] [-m system] [-p string] [-C config_file]
[-M path] [-P pager] [-S section_list] [section] name .
DESCRIPTION
man formats and displays the on-line manual pages.This
version knows about the MANPATH and PAGER environment
variables, so you can have your own set(s) of personal man
pages and choose whatever program you like to display the
formatted pages. If section is specified, man only looks
in that section of the manual. You may also specify the
order to search the sections for entries and which preprocessors
to run on the source files via command line
options or environment variables. If name contains a /
then it is first tried as a filename, so that you can do
</PRE>
<!-- END CODE //-->
<H4 ALIGN="LEFT"><A NAME="Heading41"></A><FONT COLOR="#000077"><I>mesg</I>
</FONT></H4>
<P>The <TT>mesg</TT> utility is run by a user to control write access others have to the terminal device associated with the standard error output. If write access is allowed, programs such as <TT>talk</TT> and <TT>write</TT> have permission to display messages on the terminal. Write access is allowed by default.</P>
<H4 ALIGN="LEFT"><A NAME="Heading42"></A><FONT COLOR="#000077"><I>mkdir</I>
</FONT></H4>
<P>The <TT>mkdir</TT> command is used to make a new directory.</P>
<H4 ALIGN="LEFT"><A NAME="Heading43"></A><FONT COLOR="#000077"><I>mkefs</I>
</FONT></H4>
<P>The <TT>mkefs</TT> command is used to make an extended filesystem. This command does not format the new filesystem, just makes it available for use.</P>
<H4 ALIGN="LEFT"><A NAME="Heading44"></A><FONT COLOR="#000077"><I>mkfs</I>
</FONT></H4>
<P><TT>mkfs</TT> is used to build a Linux filesystem on a device, usually a hard disk partition. The syntax for the command is <TT>mkfs</TT> <TT><filesystem></TT>, where <TT><filesystem></TT> is either the device name (such as <TT>/dev/hda1</TT>) or the mount point (for example, <TT>/</TT>, <TT>/usr</TT>, <TT>/home</TT>) for the filesystem.</P>
<H4 ALIGN="LEFT"><A NAME="Heading45"></A><FONT COLOR="#000077"><I>mkswap</I>
</FONT></H4>
<P><TT>mkswap</TT> sets up a Linux swap area on a device (usually a disk partition).</P>
<P>The device is usually of the following form:</P>
<!-- CODE SNIP //-->
<PRE>
/dev/hda[1-8]
/dev/hdb[1-8]
/dev/sda[1-8]
/dev/sdb[1-8]
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading46"></A><FONT COLOR="#000077"><I>more</I>
</FONT></H4>
<P><TT>more</TT> is a filter for paging through text one screen at a time. This command can only page down through the text, as opposed to <TT>less</TT>, which can page both up and down though the text.</P>
<H4 ALIGN="LEFT"><A NAME="Heading47"></A><FONT COLOR="#000077"><I>mount</I>
</FONT></H4>
<P><TT>mount</TT> attaches the filesystem specified by <TT>specialfile</TT> (which is often a device name) to the directory specified as the parameter. Only the superuser can <TT>mount</TT> files. If the <TT>mount</TT> command is run without parameters, it lists all the currently mounted filesystems. The following is an example of the <TT>mount</TT> command:</P>
<!-- CODE SNIP //-->
<PRE>
svr01:/home/dpitts$ mount
/dev/hda1 on / type ext2 (rw)
/dev/hda2 on /var/spool/mail type ext2 (rw,usrquota)
/dev/hda3 on /logs type ext2 (rw,usrquota)
/dev/hdc1 on /home type ext2 (rw,usrquota)
none on /proc type proc (rw)
</PRE>
<!-- END CODE SNIP //-->
<H4 ALIGN="LEFT"><A NAME="Heading48"></A><FONT COLOR="#000077"><I>mv</I>
</FONT></H4>
<P>The <TT>mv</TT> command is used to move an object from one location to another location. If the last argument names an existing directory, the command moves the rest of the list into that directory. If two files are given, the command moves the first into the second. It is an error to have more than two arguments with this command unless the last argument is a directory.</P>
<H4 ALIGN="LEFT"><A NAME="Heading49"></A><FONT COLOR="#000077"><I>netstat</I>
</FONT></H4>
<P><TT>netstat</TT> displays the status of network connections on either TCP, UDP, RAW, or UNIX sockets to the system. The <TT>-r</TT> option is used to obtain information about the routing table. The following is an example of the <TT>netstat</TT> command:</P>
<!-- CODE //-->
<PRE>
svr01:/home/dpitts$ netstat
Active Internet connections
Proto Recv-Q Send-Q Local Address Foreign Address
(State)
User
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -