Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2002 22:27:33 -0800
From:      "Crist J. Clark" <cjc@FreeBSD.ORG>
To:        AMI Root <amiroot@yahoo.com>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: Question about cat command
Message-ID:  <20020128222733.E30530@blossom.cjclark.org>
In-Reply-To: <20020129060826.17449.qmail@web9607.mail.yahoo.com>; from amiroot@yahoo.com on Tue, Jan 29, 2002 at 02:08:26PM %2B0800
References:  <20020129060826.17449.qmail@web9607.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jan 29, 2002 at 02:08:26PM +0800, AMI Root wrote:
> hihi all,
> 
> I'm using FreeBSD4.4 on a P5-166 machine with 64MB
> Ram. I found that I can "cat" a directory and it will
> list garbage. Is it a bug or I made anything wrong???

That is expected. A "directory" is actually just a special file that
contains information about the files in that directory (maps names to
inodes on the disk, etc.). Progams like ls(1) treat these special
files differently. cat(1) does not. It just dumps the contents of the
file, this directory file, without interpreting it as anything
special.
-- 
Crist J. Clark                     |     cjclark@alum.mit.edu
                                   |     cjclark@jhu.edu
http://people.freebsd.org/~cjc/    |     cjc@freebsd.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020128222733.E30530>