Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-08-2005, 12:56 PM   #1
Echo Kilo
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Rep: Reputation: 30
Using ls

When using ls -l, what is the total that is given at the top? It doesn't appear to correspond with the number of files I see.

What option can you use to display the number of files in a directory?
Old 07-08-2005, 12:59 PM   #2
Senior Member
Registered: Dec 2003
Location: Paris
Distribution: Slackware forever.
Posts: 2,382

Rep: Reputation: 91
Take a look at man ls.
Old 07-09-2005, 04:38 PM   #3
Echo Kilo
Registered: Jul 2004
Distribution: Ubuntu - Debian Based
Posts: 242

Original Poster
Rep: Reputation: 30
Okay, I read that but still don't know what the total below means. Man page also doess not state which option will report total files.

ls -l

total 96
drwx------ 4 ekridaka students 4096 Jul 6 01:56 .
drwxr-xr-x 24 root root 4096 Jun 30 17:14 ..
Old 07-09-2005, 05:22 PM   #4
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
That value is actually explained in
info coreutils ls

But the OP could have found that themselves if they
had been curious enough and read the entire man-
page themselves, and followed the advice in the
SEE ALSO section of man.

In brief, the total gives the total number of BLOCKS
used by the directory.

Old 07-09-2005, 07:04 PM   #5
Registered: May 2005
Posts: 378

Rep: Reputation: 33
A neat trick that ls does is columnarise output if it's going to a terminal, otherwise it prints one filename per line. The -1 flag replicates this behaviour to a terminal. To replicate the terminal behaviour to a non-terminal device, use -C.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration