问题描述
99.9%的时间里,我不在意多少链接指向一个文件。如何获取可用的(或者,ls)不显示链接数?
为了引用,ls -l的输出是这样的:
-rw-rw-rw- 1根目录104 Dec 25 19:32文件
在这种情况下,链接的数量是1. ls有一个标志来删除组号(104),但没有一个可以从我可以告诉的内容中删除链接数。 p>
我很怕编辑格式会打乱dired的解析,因为ls有一个特殊的标志来产生输出到dired。
为了控制在dired中显示的内容,您可以自定义变量 dired-listing-switches
。但是,如你所说,不显示链接数不是一个选项。
稍微不同的方法是使用包,它隐藏所有的细节,直到你想要它们。这隐藏了链接的数量(也隐藏了其他信息)。按照链接查找包(和,这听起来像是修正了 dired-details
的一些不便之处。
原始答案信息如下:
(setq dired-listing-switches-l)
从信息页:
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.
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:
这篇关于如何隐藏数字链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!