📄 ch50_12.htm
字号:
<HTML><!--Distributed by F --><HEAD><TITLE>[Chapter 50] 50.12 Common UNIX Error Messages </TITLE><METANAME="DC.title"CONTENT="UNIX Power Tools"><METANAME="DC.creator"CONTENT="Jerry Peek, Tim O'Reilly & Mike Loukides"><METANAME="DC.publisher"CONTENT="O'Reilly & Associates, Inc."><METANAME="DC.date"CONTENT="1998-08-04T21:57:06Z"><METANAME="DC.type"CONTENT="Text.Monograph"><METANAME="DC.format"CONTENT="text/html"SCHEME="MIME"><METANAME="DC.source"CONTENT="1-56592-260-3"SCHEME="ISBN"><METANAME="DC.language"CONTENT="en-US"><METANAME="generator"CONTENT="Jade 1.1/O'Reilly DocBook 3.0 to HTML 4.0"><LINKREV="made"HREF="mailto:online-books@oreilly.com"TITLE="Online Books Comments"><LINKREL="up"HREF="ch50_01.htm"TITLE="50. Help--Online Documentation, etc."><LINKREL="prev"HREF="ch50_11.htm"TITLE="50.11 Writing a Simple Man Page with the -man Macros "><LINKREL="next"HREF="ch51_01.htm"TITLE="51. Miscellaneous Useful Programs and Curiosities"></HEAD><BODYBGCOLOR="#FFFFFF"TEXT="#000000"><DIVCLASS="htmlnav"><H1><IMGSRC="gifs/smbanner.gif"ALT="UNIX Power Tools"USEMAP="#srchmap"BORDER="0"></H1><MAPNAME="srchmap"><AREASHAPE="RECT"COORDS="0,0,466,58"HREF="index.htm"ALT="UNIX Power Tools"><AREASHAPE="RECT"COORDS="467,0,514,18"HREF="jobjects/fsearch.htm"ALT="Search this book"></MAP><TABLEWIDTH="515"BORDER="0"CELLSPACING="0"CELLPADDING="0"><TR><TDALIGN="LEFT"VALIGN="TOP"WIDTH="172"><ACLASS="SECT1"HREF="ch50_11.htm"TITLE="50.11 Writing a Simple Man Page with the -man Macros "><IMGSRC="gifs/txtpreva.gif"SRC="gifs/txtpreva.gif"ALT="Previous: 50.11 Writing a Simple Man Page with the -man Macros "BORDER="0"></A></TD><TDALIGN="CENTER"VALIGN="TOP"WIDTH="171"><B><FONTFACE="ARIEL,HELVETICA,HELV,SANSERIF"SIZE="-1">Chapter 50<BR>Help--Online Documentation, etc.</FONT></B></TD><TDALIGN="RIGHT"VALIGN="TOP"WIDTH="172"><ACLASS="CHAPTER"HREF="ch51_01.htm"TITLE="51. Miscellaneous Useful Programs and Curiosities"><IMGSRC="gifs/txtnexta.gif"SRC="gifs/txtnexta.gif"ALT="Next: 51. Miscellaneous Useful Programs and Curiosities"BORDER="0"></A></TD></TR></TABLE> <HRALIGN="LEFT"WIDTH="515"TITLE="footer"></DIV><DIVCLASS="SECT1"><H2CLASS="sect1"><ACLASS="title"NAME="UPT-ART-4150">50.12 Common UNIX Error Messages </A></H2><PCLASS="para">For new UNIX users, one common frustration is that error messages areoften nonexistent, usually terse, and often extremely obscure.Something like <CODECLASS="literal">Command not found</CODE> is reasonably self-explanatory,most of the time; but what about <CODECLASS="literal">You don't exist. Go away.</CODE>?</P><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-59702"></A>Here, I cover some of the more common, obscure, oramusing messages that are around [or <EMCLASS="emphasis">were</EM> around. Many versions of UNIX have been "sanitized."Instead of "Intruder alert!," for example, SunOS 4.1.3 says"no login associated with uid <EMCLASS="emphasis">num</EM>."Pity. <CODECLASS="literal">:-)</CODE> <EMCLASS="emphasis">-JP</EM> ].I'll try to keep it brief, whichmeans that it will be far from comprehensive.A complete list of allthe messages you might get could easily fill a book - and lots of themessages report situations that you'd have to try <EMCLASS="emphasis">very</EM> hard toreconstruct.<ACLASS="indexterm"NAME="AUTOID-59709"></A></P><DLCLASS="variablelist"><DTCLASS="term"><CODECLASS="literal">arguments too long</CODE></DT><DDCLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-59717"></A><ACLASS="indexterm"NAME="AUTOID-59720"></A>UNIX has an unfortunate limit to the maximum length (in characters) ofall arguments you can put on the command line.This limit wasoriginally fairly small; in the past few years, it's becomequite large (5120 characters on SVR4), but no one has yet fixed thebasic problem.So if you give a command like <CODECLASS="literal">ls <SPANCLASS="link">/*/*/*/* (<ACLASS="linkend"HREF="ch15_01.htm#UPT-ART-1480"TITLE="File Naming Wildcards ">15.1</A>)</SPAN>,</CODE>you're very likely to find out that your argument list is too long.Workarounds for this problem are discussed in articles<ACLASS="xref"HREF="ch09_21.htm"TITLE="Handle Too-Long Command Lines with xargs ">9.21</A>and<ACLASS="xref"HREF="ch09_23.htm"TITLE='Workaround for "Arguments too long" Error'>9.23</A>.<ACLASS="indexterm"NAME="AUTOID-59727"></A><ACLASS="indexterm"NAME="AUTOID-59730"></A></P></DD><DTCLASS="term"><CODECLASS="literal">awk: bailing out near line</CODE> <EMCLASS="emphasis">n</EM></DT><DDCLASS="listitem"><PCLASS="para">You're running an <SPANCLASS="link"><EMCLASS="emphasis">awk</EM> (<ACLASS="linkend"HREF="ch33_11.htm"TITLE="Quick Reference: awk ">33.11</A>)</SPAN>script that has a syntax error.The standard <EMCLASS="emphasis">awk</EM> is incredibly uninformative about syntaxerrors; this is all the help you're likely to get.Newer versions(like <SPANCLASS="link"><EMCLASS="emphasis">nawk</EM> and <EMCLASS="emphasis">gawk</EM> (<ACLASS="linkend"HREF="ch33_12.htm"TITLE="Versions of awk ">33.12</A>)</SPAN>)have more intelligent error messages.</P></DD><DTCLASS="term"><CODECLASS="literal">bad magic number</CODE></DT><DDCLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-59749"></A><ACLASS="indexterm"NAME="AUTOID-59751"></A><ACLASS="indexterm"NAME="AUTOID-59754"></A><ACLASS="indexterm"NAME="AUTOID-59757"></A>You're most likely to get this message when you give a UNIX command.You can also get this message from programs like <EMCLASS="emphasis">ld</EM>, the linkeditor for programmers.<ACLASS="indexterm"NAME="AUTOID-59761"></A><ACLASS="indexterm"NAME="AUTOID-59763"></A>A "magic number" is a special number in an executable file thattells the kernel what kind of file it's dealing with.If you get thismessage, the file you're trying to execute may have been corrupted; orit may be an executable for another kind of computer;or it may not be an executable file at all.<ACLASS="indexterm"NAME="AUTOID-59766"></A></P></DD><DTCLASS="term"><CODECLASS="literal">broken pipe</CODE></DT><DDCLASS="listitem"><PCLASS="para">This message appears when you're running a pipeline, and one part ofthe pipeline terminates before the rest.For example, say you'rerunning the command:</P><PCLASS="para"><BLOCKQUOTECLASS="screen"><PRECLASS="screen">% <CODECLASS="userinput"><B>ls -l | more</B></CODE></PRE></BLOCKQUOTE></P><PCLASS="para">If the <EMCLASS="emphasis">more</EM> program quits (for any reason, like using its"quit" command) beforeit has read all the data from <EMCLASS="emphasis">ls</EM>, you have a "brokenpipe."<ACLASS="indexterm"NAME="AUTOID-59779"></A></P></DD><DTCLASS="term"><CODECLASS="literal">bus error (core dumped)</CODE></DT><DDCLASS="listitem"><PCLASS="para">This is similar in nature to a segmentation fault.There's a subtledifference in that a "bus error" means that the kernel didn't detect theproblem on its own; the memory system (i.e., hardware) realized thatthere was a problem.On many UNIX systems, this message can mean that you're trying to doan I/O operation incorrectly - you may be trying to access a devicethat doesn't exist, or something of that nature.What does I/O haveto do with memory? A lot, but that's beyond the bounds of this book.<ACLASS="indexterm"NAME="AUTOID-59786"></A></P></DD><DTCLASS="term"><CODECLASS="replaceable"><I>somecmd</I></CODE>: command not found</DT><DDCLASS="listitem"><PCLASS="para">You probably either misspelled the name of the command or it isn't in your<SPANCLASS="link">search path (<ACLASS="linkend"HREF="ch08_07.htm"TITLE="Setting Your Search Path ">8.7</A>)</SPAN>.The more insidious form of this error happens when you're writing ascript for the shell, Perl, <EMCLASS="emphasis">awk</EM>, etc. with the<SPANCLASS="link"><CODECLASS="literal">#!</CODE> notation (<ACLASS="linkend"HREF="ch45_03.htm"TITLE="Don't Need a Shell for Your Script? Don't Use One ">45.3</A>)</SPAN>.You double-check the command name and your path;<SPANCLASS="link"><EMCLASS="emphasis">which</EM> (<ACLASS="linkend"HREF="ch50_08.htm"TITLE="Which Version Am I Using? ">50.8</A>)</SPAN>tells you the command can be found.The trouble is probably an incorrect pathname for the interpreter,like <CODECLASS="literal">#!/bin/hs</CODE> for an <EMCLASS="emphasis">sh</EM> script.</P></DD><DTCLASS="term"><CODECLASS="literal">cross-device link</CODE></DT><DDCLASS="listitem"><PCLASS="para"><ACLASS="indexterm"NAME="AUTOID-59806"></A><ACLASS="indexterm"NAME="AUTOID-59809"></A>You attempted to create a hard link to a file on another filesystem.Try a <SPANCLASS="link">symbolic link (<ACLASS="linkend"HREF="ch18_04.htm"TITLE="More About Links ">18.4</A>)</SPAN>instead.<ACLASS="indexterm"NAME="AUTOID-59812"></A><ACLASS="indexterm"NAME="AUTOID-59814"></A><ACLASS="indexterm"NAME="AUTOID-59817"></A><ACLASS="indexterm"NAME="AUTOID-59820"></A></P></DD><DTCLASS="term"><CODECLASS="literal">directory not empty</CODE></DT><DDCLASS="listitem"><PCLASS="para">You tried to delete a directory that's not empty, and <EMCLASS="emphasis">rmdir</EM> won'tlet you.The solution is simple enough; butoften, when you try to list the directory, it will look empty.Didyou check for<SPANCLASS="link">"invisible" filenames (<ACLASS="linkend"HREF="ch16_11.htm"TITLE="Showing Hidden Files with ls -A and -a ">16.11</A>)</SPAN>(most likely, filenames beginningwith a dot)?There are probably a few "turds" left over from someediting session.If you're absolutely sure that none of theseinvisible files are meaningful, just use<SPANCLASS="link"><EMCLASS="emphasis">rm -rf</EM> (<A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -