Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

The best I could find via Google/man ls was:

ls -l | grep -v '^total'

Is there something I'm missing in the flags to ls?

Also, why is the total size in kb, regardless of the -h flag? scratch that, seems like it does, not sure what I was seeing then.

share|improve this question
2  
Perhaps a little bit more efficient could be ls -l | tail -n+2, for the rest I do not have an answer. – enzotib Sep 13 '11 at 9:25
I like enzotib's method more. Suggestion: set it up as an alias and name it lsl. Just 3 letters ;) oh and ls -lh shows me 1.2K styled sizes. – Rinzwind Sep 13 '11 at 9:30

1 Answer

up vote 4 down vote accepted

Looking in the source code of coreutils, I found out that total will always be displayed when using the -l option on directories.

Using the -d option to list entries instead of directory contents hides total. But if you run that without arguments (or on a directory), it'll just show the directory and not its contents. Therefore, you need wildcards. * matches all files and .* matches hidden files as well (which corresponds with the -a option):

ls -ld * .*

As for the -h option, it works for me. 1118360 bytes show up as 1.1M. Files smaller than 1024 show up in bytes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.