如何隐藏 dired 中的链接数量?
99.9% 的情况下,我并不关心有多少链接指向一个文件。如何让 dired(或者 ls)不显示链接数量?
作为参考, ls -l 的输出类似于:
-rw-rw-rw- 1 root dir 104 Dec 25 19:32 file
The number of links, in this case, is 1. ls 有一个标志来删除组号 (104),但没有一个标志来删除链接数,根据我的数据可以告诉。
我担心编辑格式会搞砸 dired 的解析,因为 ls 有一个特殊的标志用于生成 dired 的输出。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要控制 dired 中内容的显示方式,您可以自定义变量
dired-listing-switches
。但是,正如您所指出的,不显示链接数量不是一种选择。稍微不同的方法是使用包
dired-details
,它会隐藏所有详细信息,直到您需要为止。这隐藏了链接的数量(但也隐藏了其他信息)。按照链接查找包(以及dired-details+
听起来它修复了
dired-details
的一些小不便。原始答案信息如下:
来自 "Entering Dired"< /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 adired-details+
which sounds like it fixes a couple minor inconveniences withdired-details
).Original answer information follows:
From the "Entering Dired" info page:
您可以使用
ls-lisp< /code>
自定义 Dired 缓冲区显示。
ls-lisp
是 GNU Emacs(22.1 或更早版本)的一部分ls-lisp
有一个ls-lisp-verbosity
自定义变量,它将允许您显示/隐藏“链接”、“uid”和“gid”。它还具有其他可能会激发您的定制兴趣的东西。我非常喜欢 ls-lisp,我在任何地方都使用它,在 Windows 甚至 Linux 会话中。
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 als-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.