Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

What options are there to change the view of a directory in emacs dired mode? How to apply it? How can I change it on the fly?

In particular I want to know:

  • How to make it show the file sizes in human readable format (MB, GB, ...)?
  • How to omit the permissions, owner and group in the list view?
  • How to change appearance of symbolic links? (I want it to be displayed like regular files i.e. without the target, but in another color to indicate that they are links).
share|improve this question
For human readable file sizes, check stackoverflow.com/a/2859033/605276 and also check the Dired+ package –  Juancho Aug 6 '12 at 12:45
Yes, read man ls and then experiment with the options to make ls work the way you want Dired to list files. Then, put (for example) this in .emacs: (setq dired-listing-switches "-lBhX") Human readable is ls -h, so that is the h. (I suppose -l is highly recommended. The rest is just what I use.) –  Emanuel Berg Aug 6 '12 at 14:58
@EmanuelBerg Thanks, then the ls option -gohL would be closest to have what I wanted... Do you know how to hide also the permissions and how I can apply this on the fly without editing my .emacs file? –  student Aug 6 '12 at 16:19
About permissions, I don't know. About on the fly, M-x set-variable RET dired-listing-switches RET "-gohL", then M-x dired (or C-x d) to see the result. Also, you could put several lines like this (setq dired-listing-switches "-lBhX") (with different options) in *scratch*, then, with the cursor just to the right of the right parenthesis, hit C-x C-e. This will probably give you even faster testing. –  Emanuel Berg Aug 6 '12 at 20:15
@EmanuelBerg Can you convert your comment into an answer, then I can accept it (even though it doesn't solve the permission question)? –  student Aug 7 '12 at 12:03

1 Answer 1

Remember that in dired mode, the s option will toggle the sort order, but with a prefix argument, will let you change the switch to ls.

From http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-Updating.html:

C-u s switches <RET> lets you specify a new value for dired-listing-switches.

So when I want human-readable sizes listed in my dired buffer, I type:

C-u s -lah <enter>

and you'll see what you need. Ditto for any other options to ls.

share|improve this answer

Your Answer


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.