Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Jan 1999 09:37:04 -0800 (PST)
From:      "K. Marsh" <durang@u.washington.edu>
To:        Graeme Tait <graeme@echidna.com>
Cc:        freebsd-newbies@FreeBSD.ORG
Subject:   Re: The FreeBSD User Guide
Message-ID:  <Pine.A41.4.05.9901080925450.125176-100000@goodall1.u.washington.edu>
In-Reply-To: <3696183A.1FD5@echidna.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 8 Jan 1999, Graeme Tait wrote:

> One specific comment - you suggest "cat" for printing files to the screen, 
> as does at least one Unix book I have.
> 
> I started off using "cat" as a raw beginner as that was what I was "told". 
> Then someone was roasted on this list for using "cat" for this purpose, and 
> ever since I've used the suggested "more" or "less". It was not explained in 
> detail why "cat" was inappropriate, although one issue seemed to be with 
> listing files with arbitrary content.

I don't know why anybody would roast someone for using "cat" on a newbie
list, but more is certainly more preferable, because if the whole file
fits on a screen, it's output is the same as that of cat, and if it
doesn't fit on a screen, then cat's doing work that doesn't provide any
benefit - because it rolls off the screen before you can read it.  Also,
more has a search feature - by type in a "/string" you can search the
document for the next occurance of "string".  This is very useful.

I'm willing to bet, however, that many books written for beginners suggest
using cat because cat is one of the most fundamental commands available in
UNIX, and a new user should learn to be proficient with cat before they
learn more.  Also, more is less valuable when working with other
begginner's commands, like tar and sort, pipes, and file redirection.
For example

	cat phonelist.txt | sort
	tar -cvf backup.tar 'cat files-to-back-up-list.txt'

(the single quotes should be the other ones - below ~ on the keyboard -
but I can't type them becuase I'm using a Mac in the lab at school.)

I don't think more would work in these cases, but....

	cat phonelist.txt | sort | more

certainly would be a good idea.

  Kenneth J. Marsh             University of Washington 
  durang@u.washington.edu        Chemical Engineering


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.A41.4.05.9901080925450.125176-100000>