LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Keep man page display (https://www.linuxquestions.org/questions/linux-newbie-8/keep-man-page-display-4175471133/)

Jeff9 07-27-2013 11:23 AM

Keep man page display
 
I'm trying to learn about (for example) the ps command. I type man 1 ps and start reading. I want to try some options I read about, so I press q, the man page disappears. WTF?

I would like to reduce the number of terminal windows I have open (I already have 3 or 4 open - one for file editing, one for compiling/executing, one or two for attempted debugging using gdb - just to do my work). Is there no way to keeping a man page up? That would be so much more convenient.

I tried man man and read about man -W. But the files listed are not text files, so I couldn't just cat them.

DavidMcCann 07-27-2013 11:42 AM

Basically, you can't do two things at the same time in one terminal!

A nice way of reading man pages is in your browser
http://www.linuxmanpages.com/
http://linux.die.net/
and your desktop's help system may incorporate man pages (Mate and Gnome do) or your distro may have a dedicated reader (Salix does).

theNbomr 07-27-2013 11:50 AM

I hear ya... I haven't yet sorted that out, but I know it doesn't happen on all systems I use. I haven't taken the time to explore it, but my hunch is that it is a result of a setting somewhere for the 'pager' system. As I understand it, man uses another facility, could be more/less or some other utility, to page through it's output. I believe there is a global or user-specific setting that governs this behavior. Sorry I can't be more specific, but if you do pursue it, I'd love to know what you come up with.

--- rod.

shivaa 07-27-2013 11:53 AM

A manual page can be kept open (i.e. in terminal after reading it) and will not get disappear after finishing it. Just check help section of man:
Code:

~$ man --help
And in following way, you can keep the page in terminal after finish reading it. You also need not to press q at the end of the page. And after reading it, you can run next command.
Code:

~$ man -P <pager-type> <command-name>
For example:
Code:

~$ man -P more ps
In addition, use spacebar key to read the manual page-by-page manner or use enter key to read the manual line-by-line.

eSelix 07-27-2013 12:12 PM

If you are using "less" for viewing man pages, you can press "!" and enter commands to execute. After execution press Enter key to back to manual.

What wrong is with multiple terminal windows? In my opinion this is most convenient.

fogpipe 07-27-2013 12:27 PM

Or you can use "ctrl-z" to background the man page you are reading and then "fg" to make it visible again after you are done entering your commands.

lleb 07-27-2013 01:18 PM

screen is your friend, yes you can do more then 1 thing in a single terminal.

https://www.rackaid.com/resources/li...al-and-how-to/

http://www.thegeekstuff.com/2010/07/...mand-examples/

http://unix.stackexchange.com/questi...-than-one-view

i use the S option a fair amount as it allows you to do exactly what you want. have the man page open at the same time you are playing with commands in an other portion of the same terminal.

Enjoy.

TB0ne 07-27-2013 02:41 PM

Quote:

Originally Posted by Jeff9 (Post 4997920)
I'm trying to learn about (for example) the ps command. I type man 1 ps and start reading. I want to try some options I read about, so I press q, the man page disappears. WTF?

I would like to reduce the number of terminal windows I have open (I already have 3 or 4 open - one for file editing, one for compiling/executing, one or two for attempted debugging using gdb - just to do my work). Is there no way to keeping a man page up? That would be so much more convenient.

I tried man man and read about man -W. But the files listed are not text files, so I couldn't just cat them.

So go to the Internet, and pull up the man pages in your web browser. Use a terminal program like konsole or yakuake, that supports tabs, and have one window up with multiple terminal windows in it.

theNbomr 07-27-2013 03:55 PM

All of those solutions require some extra component, which is a fair suggestion for most cases. Sometimes, you only have one console, such as if you don't have an X server, or if your connection is a serial console.
The -X option to less seems to have the desired effect. Now, just how to get the -X option to be used by man when it invokes less...

--- rod.

theNbomr 07-27-2013 04:04 PM

Found it!!
Code:

export LESS='-X'
less gets used as the pager, and it reads its options from the $LESS environment variable. If your $LESS is already specified, you'll have to add the -X option to whatever is already there. You can set the variable in your user .bashrc, or in the global one in /etc.

--- rod.

Habitual 07-27-2013 05:00 PM

Code:

export LESS='FiX'
I've used this for at least 2 years. :)

lleb 07-27-2013 07:29 PM

Quote:

Originally Posted by theNbomr (Post 4998072)
All of those solutions require some extra component, which is a fair suggestion for most cases. Sometimes, you only have one console, such as if you don't have an X server, or if your connection is a serial console.
The -X option to less seems to have the desired effect. Now, just how to get the -X option to be used by man when it invokes less...

--- rod.

and how does screen, something that is rather basic, require extra components. is that not what its use is? to accomplish more then one task inside of one terminal when you dont have the luxury of a GUI or the ability to switch to an other terminal connection as you might be using something like ssh.

theNbomr 07-28-2013 11:52 AM

screen IS the extra component. Yes, I realize it comes pre-installed on many distros, but it requires deliberate use for it to be a solution, and for those cases where console resources are scarce, it is often the case that memory, storage and CPU is also scarce, so it's memory footprint can matter. Moreover, it doesn't solve the problem of having the relevant passage of the man page visible while typing at the commandline, which is the case I find most troubling when the man page disappears after I've found what I'm looking for.

Don't get me wrong, I use screen all the time and for some pretty outside the box purposes so I'm not saying it isn't a useful tool.
--- rod.

lleb 07-29-2013 06:01 PM

http://notary.brunkow.ws/images/terminal_screens.png

have screen running, using man page and issuing commands at the $ prompt.

as for its CPU usage, a single terminal even running screen is next to minimal. if you are running out of system resources running a terminal and screen, you have bigger problems then looking at the man page while issuing commands.

heck split that into 4 if you wish and get even more accomplished at once. although the most ive ever needed at any one time other then playing around or performing the same task on multiple servers via ssh is 3. typically monitoring some log file in one -S, top or some other tool in a second -S, and then issuing the command in the third -S.

astrogeek 07-29-2013 06:16 PM

Just split the window with screen.

I use tmux, but same idea for screen.

Ctrl-A-" - splits window
man whatever

Ctrl-A-O - switch back and forth between split windows

Ctrl-A-X - close current side of split

How much easier do you want it to be?

[EDIT]
lleb beat me to it - have a look at his/her screenshot.
[/EDIT]


All times are GMT -5. The time now is 08:48 PM.