[comp.sys.mac.comm] NCSA Telnet - ftp - and ls -lt | head

18215MES@MSU.BITNET (07/24/90)

Hi folks,
I find it valuable to connect to stanford - sumex via ncsa telnet,
and would like to see the most recent postings in a few of the
directories. I know that I can do a ls -lt  to list sorted by
most recent additions, but how can I limit it to the first
10 - 15 lines of output?
On unix, I can pipe the output to head which only prints the
first 10-20 lines of output...
Any Ideas?
Thanks , mark sartor

]) (07/25/90)

In article <48418215MES@MSU> 18215MES@MSU.BITNET writes:
>Hi folks,
>I find it valuable to connect to stanford - sumex via ncsa telnet,
>and would like to see the most recent postings in a few of the
>directories. I know that I can do a ls -lt  to list sorted by
>most recent additions, but how can I limit it to the first
>10 - 15 lines of output?


Sure:

	ls -lt | sed 15q

		-or-

	ls -ltd */* | sed 15q

where the sed in each case will quit (and close stdin) after reading
and printing 15 lines.  I use the second call (ls -ltd */*) to get
a time-ordered list of files in subdirectories, without listing either
the directory names themselves or files lower than that.

...Kris
-- 
Kristopher Stephens, | (408-746-6047) | krs@uts.amdahl.com | KC6DFS
Amdahl Corporation   |                |                    |
     [The opinions expressed above are mine, solely, and do not    ]
     [necessarily reflect the opinions or policies of Amdahl Corp. ]

epsilon@wet.UUCP (Eric P. Scott) (07/26/90)

In article <48418215MES@MSU> 18215MES@MSU.BITNET writes:
>             I know that I can do a ls -lt  to list sorted by
>most recent additions, but how can I limit it to the first
>10 - 15 lines of output?

You could always use  ls -ltr  to sort in reverse time order.

					-=EPS=-