ls question

Sam Tregar sam at tregar.com
Wed Jul 21 22:15:50 UTC 2004


On Wed, 21 Jul 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?

I use 'du' for this.  For example, to see how much space I'm wasting
on mp3s:

  $ cd mp3
  $ du -sh .
  3.6G     .

That number includes all the files in mp3/ and all subdirectories,
which is usually what I want.  For more information about 'du' run
'man du'.

-sam





More information about the fedora-list mailing list