When I type man bash
it shows the info in the terminal itself.
How do I tell "man
" to open up the info in gedit instead? Is this possible?
When I type man bash
it shows the info in the terminal itself.
How do I tell "man
" to open up the info in gedit instead? Is this possible?
Simply enter the following in the terminal:
man bash >/tmp/t;gedit /tmp/t
That will create a temporary file with the contents of the man page and open it with gedit
.
gedit <(man bash)
– Lekensteyn
Dec 23 '11 at 11:06
<()
process substitution, nor does it open piped input. (tested in 2.30.3, and 3.4.1)
– Peter.O
Sep 04 '12 at 06:21
kate
either. nano
can open it as read-only though.
– Lekensteyn
Sep 04 '12 at 11:34
Better yet, have man format it in HTML and open it in firefox
#!/bin/bash
# open a man page in firefox
# loop through all parameters in order
for i
do
# if the manpage was found, spawn it in a browser window
man -f "$i" > /dev/null && coproc man --html=firefox "$i"
done
~/bashrc
... fman () { until [[ -z $1 ]] ;do man -f "$1" 2>/dev/null && coproc man --html=firefox "$1"; shift; done; }
– Peter.O
Sep 04 '12 at 07:02
As well as opening the man page in gedit
(like the other answers have demonstrated), you can also make a pdf of the man page (as first noted in this article) and then display it in evince
. (You need ps2pdf
and evince
installed). The pdf file is created in your present working directory and is retained after evince
is closed.
Simply modify the command below according to the man page that you want and change the file names or else the resulting pdf files will be overwritten. Here is an example for dpkg
:
man -t dpkg | ps2pdf - dpkg.pdf && evince dpkg.pdf
However, it is probably much more useful to construct a function. You could add the following function to your .bashrc
or .bash_aliases
(assuming you have evince
and ps2pdf
installed; the latter is in the ghostscript
package):
mikman() { man -t "$1" | ps2pdf - "$1".pdf && setsid evince "$1".pdf; }
After adding the function, you have to run . .bashrc
(or . .bash_aliases
) to source your configuration files, or restart the terminal for it to take effect.
Call the function with the name of any program that has a manpage, such as mikman dpkg
, and it will carry out the commands and launch the manpage as a pdf. Launching the manpage as a pdf in your pdf reader gives you a very useful gui wherein search tools and the like can be utilised.
man -t glFrustum
), pic(1) diagrams (man -t soelim
), tbl(1) tables (man -t nft
) etc! . It's also possible to use TeX's dvi format instead of postscript, for even better results (especially for eqn formulas): man -Tdvi glMultMatrix > t.dvi && dvipdfmx t.dvi && xdg-open t.pdf
– Beni Cherniavsky-Paskin
Apr 27 '22 at 06:51
You can browse man pages on-line http://manpages.ubuntu.com/ or install dwww package and browse all documentation off-line (http://localhost/dwww
). See description of dwww package and/or read man dwww after installation.
You may be also interested in browsing package contents – install dpkg-www package and do the same: See description of dpkg-www package and/or read man dpkg-www after installation. Start dpkg-www
or browse http://localhost/cgi-bin/dpkg
.
On a case-by-case basis you can do:
man mount > mount.txt
The .txt file will be in your current directory.
man mount > mount.txt && gedit mount.txt
will open the file in gedit.
This will create a temporary file with the manual page for bash in your home directory entitled "man" and open it with gedit. As soon as you close gedit the file will be erased too. Just replace bash with whatever man page you want to open.
man bash >> ~/man && gedit ~/man && rm ~/man
Hope this helps :)
gedit
detaches itself from the terminal with an exit code of 0
, so the rm
step is executed immediately. This causes ~/man
to be deleted before gedit has even loaded it...
– Peter.O
Sep 04 '12 at 06:31
yelp man:bash
of course, if you are on somebody else's desktop. – JanC Apr 20 '11 at 12:18yelp "man:init(5)"
instead ofman 5 init
(this doen't work with the current version of zengr's bash function). – JanC Apr 20 '11 at 13:47