ls question

John Thompson JohnThompson at new.rr.com
Sat Jul 24 19:02:05 UTC 2004


Michael Sullivan wrote:

> I've only been using Linux for about a year now (actually it's a year
> this month).  My first computer was an IBM 8086 clone with MS-DOS 2.0. 
> I liked MS-DOS a lot better than MSWindows because if something went
> wrong, the problem was a lot easier to find:  all the files needed for a
> single application were all kept in the same directory, etc.  Anyway, in
> MS-DOS, when you ask for a directory listing, it listed the files in the
> directory you were asking for (like ls), but it also gave a listing of
> the total bytes contained in the files in the listing you asked for.  I
> was wondering if there was any way I could do that with ls.  I know that
> with nautilus you can do a Cntrl-A to select all the files in the
> directory you're currently viewing and the total byte size will be shown
> in the status bar, but is there a way to find out from a terminal
> window?

"man du"

du will show file sizes; with the "-h" switch it will convert them into 
"human-friendly" format, and with the "-c" switch provide a sum of the 
sizes:

[john at starfleet tests]$ du -h -c *.in
1.0K	all.in
1.0K	am.in
1.0K	cubic.in
1.0K	derive.in
1.0K	ellipse.in
1.0K	finance.in
1.0K	heron.in
2.0K	limit.in
1.0K	pie.in
1.0K	points.in
1.0K	pyth3d.in
1.0K	test.in
1.0K	test3.in
1.0K	test4.in
1.0K	test6.in
16K	total




-- 

-John (john at os2.dhs.org)





More information about the fedora-list mailing list