I use Guake terminal emulator a lot. It's the best thing since sliced bred 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?
The man page for man has this part:
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.
man command in Linux is used to display the user manual of any command that we can run on the terminal. It provides a detailed view of the command which includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, EXIT STATUS, RETURN VALUES, ERRORS, FILES, VERSIONS, EXAMPLES, AUTHORS and SEE ALSO. 1.
The man command provides reference information on topics, such as commands, subroutines, and files. The man command provides one-line descriptions of commands specified by name. The man command also provides information on all commands whose descriptions contain a set of user-specified keywords.
DESCRIPTION top The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of processes or threads currently being managed by the Linux kernel.
Typing f and F activates Fields-Management. According to the top man page: These keys display a separate screen where you can change which fields are displayed, their order, and also designate the sort field. I've added PPID (Parent Process Id), SWAP, and nTH as well.
As pointed out in other answers, setting and exporting MANWIDTH
properly is the way to go.
I would avoid hardcoding it, or else it will overflow / have ugly linebreaks when your terminal emulator window is more narrow than that value:
NAME
grep, egrep, fgrep - print lines that match
patterns
SYNOPSIS
grep [OPTION...] PATTERNS [FILE...]
grep [OPTION...] -e PATTERNS ... [FILE...]
grep [OPTION...] -f PATTERN_FILE ... [FILE.
..]
DESCRIPTION
grep searches for PATTERNS in each FI
LE. PATTERNS is one or more
patterns separated by newline characters, a
nd grep prints each line
that matches a pattern. Typically PATTERN
S should be quoted when grep
is used in a shell command.
Here's what I use, in a handy alias:
alias man='MANWIDTH=$((COLUMNS > 80 ? 80 : COLUMNS)) man'
This sets MANWIDTH
to 80 if the terminal window is wider than that, and to COLUMNS
(the current width of the terminal window) if it is more narrow.
Result in a wide window:
NAME
grep, egrep, fgrep - print lines that match patterns
SYNOPSIS
grep [OPTION...] PATTERNS [FILE...]
grep [OPTION...] -e PATTERNS ... [FILE...]
grep [OPTION...] -f PATTERN_FILE ... [FILE...]
DESCRIPTION
grep searches for PATTERNS in each FILE. PATTERNS is one or more
patterns separated by newline characters, and grep prints each line
that matches a pattern. Typically PATTERNS should be quoted when grep
is used in a shell command.
Result in a narrow window:
NAME
grep, egrep, fgrep - print lines that
match patterns
SYNOPSIS
grep [OPTION...] PATTERNS [FILE...]
grep [OPTION...] -e PATTERNS ...
[FILE...]
grep [OPTION...] -f PATTERN_FILE ...
[FILE...]
DESCRIPTION
grep searches for PATTERNS in each
FILE. PATTERNS is one or more
patterns separated by newline
characters, and grep prints each line
that matches a pattern. Typically
PATTERNS should be quoted when grep is
used in a shell command.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With