tags:

views:

154

answers:

2

99.9% of the time, I don't care how many links are pointing to a file. How do I get dired (or alternatively, ls) to not display the number of links?

For reference, the output of ls -l is something like:

-rw-rw-rw- 1 root   dir 104 Dec 25 19:32 file

The number of links, in this case, is 1. ls has a flag to remove the group number (104) but not one to remove the number of links, from what I can tell.

I'm afraid editing the format will screw up dired's parsing, as ls has a special flag for producing output to dired.

+3  A: 

To control how things are displayed in dired, you can customize the variable dired-listing-switches. However, as you noted, not displaying the number of links is not an option.

A slightly different approach would be to use the package dired-details, which hides all details until you want them. This hides the number of links (but also hides other information). Follow the link to find the package (and a dired-details+ which sounds like it fixes a couple minor inconveniences with dired-details).

Original answer information follows:

(setq dired-listing-switches "-l")

From the "Entering Dired" info page:

The variable dired-listing-switches' specifies the options to give to ls' for listing the directory; this string must contain -l'. If you use a numeric prefix argument with the dired' command, you can specify the ls' switches with the minibuffer before you enter the directory specification. No matter how they are specified, the ls' switches can include short options (that is, single characters) requiring no arguments, and long options (starting with --') whose arguments are specified with ='.

Trey Jackson
I spoke too soon: the number I am referring to is the the number of links pointing to the file, not the inode. I think I got them confused because each inode stores the number of links. Sorry for the confusion; initial post updated accordingly.
Christopher Monsanto
(in response to your edit) dired-details looks exactly like what I'm looking for. Don't know how I missed it.
Christopher Monsanto
There's so much stuff out there. Just yesterday I posted a link to a package that solved a problem, but Emacs already had built-in stuff that did nearly exactly the same thing.
Trey Jackson
+1  A: 

You can use ls-lisp to customize the dired buffer display. ls-lisp is part of GNU Emacs (22.1 or perhaps even earlier) ls-lisp has a ls-lisp-verbosity customize variable that will allow you to show/hide "links", "uid" and "gid". It also has other things that may tickle your customize fancy.

I like ls-lisp so much I use it everywhere, on my Windows and even Linux sessions.

piyo