Search for string while viewing a manpage - manpage

When viewing a manpage say man ls, how does one search the content of the man page? (similarly, in vim you can call :/search_string what is a comprable command while viewing a man page?)

It depends on which pager you use, which depends on your MANPAGER/PAGER environment variable. The manpage of man says:
If MANPAGER is set, its value is used as the name of the program to use to display the man page. If not, then PAGER is used. If that has no value either, /usr/bin/less -is is used.
Note that on Debian unstable the default is pager -s (managed by alternatives).
So, if you actually are using less, just type /searchstring, similar to vim.
See also the manpage of less on how to navigate in less.

On Ubuntu (and probably similar distributions), you type "/" followed by what you want to search for
Example:
/word
Pressing "n" jumps to the next hit

Related

How to make podlinkcheck not complain about URLs with a fragment

I have a Perl module with a L<...> link like this:
=head1 ...
See L<RFC 8250|https://datatracker.ietf.org/doc/html/rfc8259#section-4>.
=cut
1;
When I run podlinkcheck (version 15) on it, it complains:
themodule.pm:3:5: no module/program/pod "https:"
even though perldoc perlpod says:
Or you can link to a web page:
Lscheme:...
L<text|scheme:...>
Links to an absolute URL. For example, Lhttp://www.perl.org/ or L<The Perl Home Page|http://www.perl.org/>.
I want to keep using podlinkcheck for all my actual Perl module links, but how do I tell it to treat links that start with https:// as hyperlinks instead of looking for a Perl module by that name?
(It seems to work when I remove the fragment (i.e., See L<RFC 8250|https://datatracker.ietf.org/doc/html/rfc8259> but especially for long documents I want to link to a particular section, not just the whole thing. Escaping the # with a backslash and putting double quotes around it did not help.)

How to configure Perl Tidy not wrap the lines?

I am using Per Tidy plugin in Padre IDE. By default, Tidy wrap my long lines into multiple lines which I don't like. How can I tell Tidy never wrap my lines?
Testing via perltidy on the command-line (referring to the man page), I found that I preferred to change the default perltidy options to always keep newlines (line breaks) by enabling "freeze newlines" (-fnl), and and disabling all whitespace modifications (-fws, freeze whitespace), via options: perltidy -fws -fhl -b
For your specific case, to ignore all line breaks, all you would needs is perltidy -fnl -b (the -b creates a backup file, and modifies in-place.)
There's also a second reasonable option of just setting the line length much longer (for example to 120 chars) than the default of 80 using: -l=120 (or: --maximum-line-length=120 or an even longer "really large number" is enabled by setting it to zero (0).
Note: as an aside, I'm testing on bluefish html editor, which uses either html tidy or perltidy, depending. For some reason, I had to change the rc file directly and couldn't change the setting in the GUI.
You can also change the default settings of perltidy. First find out where it is installed:
perl -MPerl::Tidy -e 'print $INC{"Perl/Tidy.pm"}'
Then edit the file where maximum-line-length is defined (or any other parameters you want). You might need sudo if perltidy is installed gobally. I usually use VS code to format my code and that in turn uses perltidy but I can't define paramters. So I found doing this particularly useful.

What does it mean "See something(3) or see something-else(5), etc..." in the man of a command in terminal? [duplicate]

This question already has answers here:
What does the number in parentheses shown after Unix command names in manpages mean?
(7 answers)
Closed 4 years ago.
I have a simple question I made my self but didn't find any answer and hints.
When I type for the man entries of a command, e.g. "man git", I get the following:
...
DESCRIPTION
...
See gittutorial(7) to get started, then see Everyday Git[1] ...
The Git User's Manual[2] has a more in-depth
introduction.
After you mastered the basic concepts, you can come back to this page to learn what commands Git offers. You can learn more about individual Git
commands with "git help command". gitcli(7) manual page gives you an overview of the command line command syntax.
Formatted and hyperlinked version of the latest Git documentation can be viewed at http://git-htmldocs.googlecode.com/git/git.html.
Could someone explain what are those "See gittutorial(7)...Everyday Git[1]...gitcli(7)" etc.? I mean, I know that they are telling "look at this resource if you want to know the basic concepts, for more info, etc.", but actually how should one interpret it?
What is the meaning of the numbers (like 7, 1, 2, etc..) inside the parenthesis or brackets? And where I can find the resources the manual is telling me to see, do I have to type something in the man prompt, or search on the Internet?
I just would like to ask for an elucidation.
Thank you for your attention!
Man pages are splitted into sections
to access a manual page inside a specific section you prepend the section number before the manpage name, for example try:
man 3 fork
or
man 2 fork
Usually the square braketed numbers are links to additional material in the NOTES section of the manpage (scroll to the bottom)
The parenthesized numbers indicate in which section of the manual the referenced entry appears. Section (1) is commands (programs), section (2) is system call functions, section (3) is general library functions, etc. Some terms have distinct entries in multiple sections. For example, this ...
man 1 printf
... gives a different manual page (from section 1, describing the printf program) than does this ...
man 3 printf
... which gives a page from section 3, describing the printf() function from the C standard library.
It means type man 7 gittutorial for more info. Man page are divided in numbered categories, sometimes overlapping. Use apropos git for instance to see the various possibilities.
The numbers in parentheses, manpage(N), are the manual section, each of the 8 sections covers a different topic.
See man-mages(7) ;) for a list of sections:
man man-pages
And you can open a manpage from a given section by including the number in the command:
man 7 man-pages
The numbers give you a hint of what the manpage will cover, e.g. time(1) is about a command, whereas time(2) is about a system call, and let you specify which section of the manual you're interested in when there's an entry with the same name on different sections.
The numbers between brackets, something[N] are footnotes, usually pointing to places where you can get more information.

TTY in perl, explaination and some examples

So I am trying run a perl debugger inside another perl debugger. I keep readin tty in perl is the solution. Can someone explain to me what tty means ( is it terminal type?) and how is it useful? This is where I read it:
http://search.cpan.org/~rjbs/perl-5.18.0/lib/perl5db.pl#$CreateTTY
The reason I am trying to use tty is because of this question I asked:
Pass argument to perl file in debugger and set breakpoint in file executed by system
Thanks to all the ones who answer, the more you guys tell me what it is, better the idea I get :)
TTY (short for teletype) is basically a special input or output filehandle that connects to the terminal - namely, user input. For nitty gritty details, see:
Unix.SE in-depth answer on TTYs
Text Terminal HOWTO
This is what you need to know for starters (hard to say more since you didn't explain what you need to do with a TTY):
On Unix, it typically maps to /dev/tty device or similar
You can test for it using -t in Perl
As far as debugger, 2 things need to be known at least (if you intend to play with the TTY, the last paragraph is the most important). All data is near-quoted from perldoc perldebug
p expr prints to $DB::OUT filehandle (NOT STDOUT), which in turn is open to /dev/tty.
I think this may be controlled by LineInfo option from PERLDB_OPTS but never played with it so not sure.
Can be affected by the following $ENV{PERLDB_OPTS} options:
TTY - The TTY to use for debugging I/O.
noTTY - If set, the debugger goes into NonStop mode and will not connect to a TTY. If interrupted (or if control goes to the debugger via explicit setting of $DB::signal or $DB::single from the Perl script), it connects to a TTY specified in the TTY option at startup, or to a tty found at runtime using the Term::Rendezvous module of your choice.
This module should implement a method named new that returns an object with two methods: IN and OUT . These should return filehandles to use for debugging input and output correspondingly. The new method should inspect an argument containing the value of $ENV{PERLDB_NOTTY} at startup, or "$ENV{HOME}/.perldbtty$$" otherwise. This file is not inspected for proper ownership, so security hazards are theoretically possible.

How do I hide number of links in 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.
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 tols' for listing
the directory; this string must
contain -l'. If you use a numeric
prefix argument with thedired'
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='.
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.