如何隐藏 dired 中的链接数量?

发布于 2024-08-14 15:41:23 字数 301 浏览 9 评论 0原文

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡淡的优雅 2024-08-21 15:41:23

要控制 dired 中内容的显示方式,您可以自定义变量 dired-listing-switches。但是,正如您所指出的,不显示链接数量不是一种选择。

稍微不同的方法是使用包 dired-details ,它会隐藏所有详细信息,直到您需要为止。这隐藏了链接的数量(但也隐藏了其他信息)。按照链接查找包(以及 dired-details+听起来它修复了 dired-details 的一些小不便。

原始答案信息如下:

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

来自 "Entering Dired"< /a> 信息页面:

变量
dired-listing-switches' 指定
提供给 ls' 进行列表的选项
目录;该字符串必须
包含<代码>-l'。如果您使用数字
前缀参数与
dired'
命令,您可以指定ls'
之前用迷你缓冲区切换
您输入目录规范。
无论它们如何指定,
ls 的开关可以包含短
选项(即单个字符)
不需要参数,而且很长
选项(以 --' 开头)
参数用
='指定。

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
='.

方圜几里 2024-08-21 15:41:23

您可以使用 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 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文