更改man命令输出的宽度

时间:2021-11-02 03:56:12

I use Guake terminal emulator a lot. It's the best thing since sliced bred IMO.

我经常使用Guake终端模拟器。这是切片育成IMO以来最好的事情。

But one thing has been bugging me, when I want to read man pages the default width of the output is the width of the terminal windows, which in my case is always full screen so it's a bit difficult to read.

但有一件事一直困扰着我,当我想阅读手册页时,输出的默认宽度是终端窗口的宽度,在我的情况下总是全屏,所以它有点难以阅读。

Is there a way I can make the default width of the output of man command a, pleasant to read, 80 characters?

有没有办法让man命令输出的默认宽度为a,阅读愉快,80个字符?

The man page for man has this part:

man的手册页有这一部分:

   MANWIDTH
          If  $MANWIDTH  is set, its value is used as the line length for which manual pages should be formatted.  If it is not set,
          manual pages will be formatted with a line length appropriate to the current terminal (using an ioctl(2) if available, the
          value  of  $COLUMNS,  or  falling  back  to 80 characters if neither is available).  Cat pages will only be saved when the
          default formatting can be used, that is when the terminal line length is between 66 and 80 characters.

But I cant figure out where to change it.

但我无法弄清楚在哪里改变它。

I tried adding the line:

我尝试添加该行:

MANWIDTH 80

to /etc/manpath.config and ~/.bashrc, but with no result.

到/etc/manpath.config和〜/ .bashrc,但没有结果。

2 个解决方案

#1


That's an environment variable.

这是一个环境变量。

Try:

MANWIDTH=80
export MANWIDTH
man bash

If you want that set permanently then you can add those first two lines to your shell session startup scripts or similar.

如果您想永久保存该设置,则可以将前两行添加到shell会话启动脚本或类似内容中。

#2


You need to set this as an environment variable.

您需要将其设置为环境变量。

MANWIDTH=80 man man

works here, and provides the manpage for man in 80 column glory.

在这里工作,并为80列荣耀的人提供了联机帮助。

If you want this in .bashrc the correct line entry is

如果你想在.bashrc中使用正确的行条目

export MANWIDTH=80

Note lack of spaces around = sign. You may or may not need export.

注意=符号周围缺少空格。您可能需要也可能不需要出口。

#1


That's an environment variable.

这是一个环境变量。

Try:

MANWIDTH=80
export MANWIDTH
man bash

If you want that set permanently then you can add those first two lines to your shell session startup scripts or similar.

如果您想永久保存该设置,则可以将前两行添加到shell会话启动脚本或类似内容中。

#2


You need to set this as an environment variable.

您需要将其设置为环境变量。

MANWIDTH=80 man man

works here, and provides the manpage for man in 80 column glory.

在这里工作,并为80列荣耀的人提供了联机帮助。

If you want this in .bashrc the correct line entry is

如果你想在.bashrc中使用正确的行条目

export MANWIDTH=80

Note lack of spaces around = sign. You may or may not need export.

注意=符号周围缺少空格。您可能需要也可能不需要出口。