4

Hi How can I use emacs find to list files without their detailed information?

C-x C-f

What I got:

-r--r--r-- user 3845 Apr 10 2014 ua.cpp
-r--r--r-- user 3845 Apr 10 2014 ub.cpp
-r--r--r-- user 3845 Apr 10 2014 uc.cpp

What I want:

ua.cpp ub.cpp uc.cpp
3
  • Why not M-! ls ?
    – djangoliv
    Commented Jul 7, 2016 at 6:51
  • 2
    I suggest using the dired+ package with diredp-hide-details-initially-flag set to t.
    – caisah
    Commented Jul 7, 2016 at 6:59
  • 1
    Did you mean C-x d instead of C-x C-f?
    – Drew
    Commented Jul 7, 2016 at 13:48

2 Answers 2

5

M-x list-directory (key C-x C-d) is probably what you want?

or

M-x dired, then M-x dired-hide-details-mode

If you always want to hide detail, add a hook. Like this:

(add-hook 'dired-mode-hook 'dired-hide-details-mode)

If you really want them all in a single line, M-x shell-command (M-!) and ls -m is probably the best.

Or, better I think is just M-x eshell, then do ls.

2
  • 2
    (add-hook 'dired-mode-hook 'dired-hide-details-mode) would also work.
    – npostavs
    Commented Jul 7, 2016 at 10:34
  • thx @npostavs, I'll edit to use your suggestion.
    – Xah Lee
    Commented Jul 8, 2016 at 7:07
3

You can use whatever ls switches (command-line options) you want, for any particular Dired listing, by using a prefix argument with the Dired commands. For example: C-u C-x d. You are prompted for the ls switches to use.

And you can set your own preference for the ls switches to use by default each time, just by customizing user option dired-listing-switches:

M-x customize-option RET dired-listing-switches RET

Then, each time you use Dired, you will get the kind of listing you prefer, and if you ever want to override your preference you just use a prefix argument (C-u).

And whenever you are in Dired you can toggle whether to show the details (whatever they are, as determined by the ls switches), using (.

2
  • This can be used to add more switches, like the Linux -Z to see SELinux info and --full-time to get more precise time information. It works fine as long as I used dired. It also works with ido-dired. However some ls switches are not supported by all OSes (like my example) and I wonder what's the best way to support ability to select switches depending on the OS (but that's another question I should probably ask separately).
    – PRouleau
    Commented Dec 10 at 19:50
  • Another aspect (and probably another separate question) is whether the dired-listing-switches have an impact on a dired buffer listing remote host files accessed via tramp. Specially if the local host and remote host do not run the same OS.
    – PRouleau
    Commented Dec 10 at 19:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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