LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2019, 11:46 PM   #1
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Rep: Reputation: 56
How to search man pages?


Hello

How to search for multiple keywords in man pages? For example, I want to search all of the man pages not just in the description but in whole for keywords like 'emergency' and 'critical'

What command should I give?

Thanks
 
Old 12-08-2019, 12:58 AM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,766

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by ddenial View Post
Hello

How to search for multiple keywords in man pages? For example, I want to search all of the man pages not just in the description but in whole for keywords like 'emergency' and 'critical'

What command should I give?

Thanks
man man should provide some direction. I've not read it all to be able to give a definitive answer. Sorry.

From within a man page, one can use / to enter a search string and use n jump to the next occurrence of the string
See details in man less
 
1 members found this post helpful.
Old 12-08-2019, 01:05 AM   #3
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos, Manjaro
Posts: 317

Rep: Reputation: 70
man -k emergency
man -k critical
 
2 members found this post helpful.
Old 12-08-2019, 01:40 AM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,161

Rep: Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125Reputation: 4125
What did your searching turn up ?.
 
Old 12-08-2019, 04:51 AM   #5
ddenial
Member
 
Registered: Dec 2016
Distribution: CentOS, Fedora, Ubuntu
Posts: 359

Original Poster
Rep: Reputation: 56
The idea is to search for topics you want to know more, but you don't know what to look for. Here in my example, I want to know more about error types and all their details. So I want to search all man pages which contain keywords like 'emergency' AND 'critical' AND 'error'. That way I know that if a man page deals with all three keywords, it's mostly dealing with error types.

So I tried the following

Code:
$ man -wK emergency
/usr/share/man/man1/brltty.1.gz
/usr/share/man/man1/dmesg.1.gz
/usr/share/man/man1/git-stash.1.gz
/usr/share/man/man1/nano.1.gz
/usr/share/man/man1/perl5004delta.1.gz
/usr/share/man/man1/perldiag.1.gz
/usr/share/man/man1/perliol.1.gz
/usr/share/man/man1/perltoc.1.gz
/usr/share/man/man1/perlvar.1.gz
/usr/share/man/man1/systemctl.1.gz
/usr/share/man/man1/systemd.1.gz
/usr/share/man/man8/btrfs-filesystem.8.gz
/usr/share/man/man8/dracut.8.gz
/usr/share/man/man8/e2image.8.gz
/usr/share/man/man8/gdisk.8.gz
/usr/share/man/man8/master.8.gz
/usr/share/man/man8/smartctl.8.gz
/usr/share/man/man8/systemd-fsck@.service.8.gz
/usr/share/man/man8/yum.8
/usr/share/man/man2/sched_setscheduler.2.gz
/usr/share/man/man5/emergencyanalysis_event.conf.5.gz
/usr/share/man/man5/rsyslog.conf.5.gz
/usr/share/man/man5/yum.conf.5
/usr/share/man/man7/bootup.7.gz
/usr/share/man/man7/dracut.bootup.7.gz
/usr/share/man/man7/dracut.cmdline.7.gz
/usr/share/man/man7/dracut.cmdline.7.gz
/usr/share/man/man7/filter.7.gz
/usr/share/man/man7/kernel-command-line.7.gz
/usr/share/man/man7/notifier.7.gz
/usr/share/man/man7/systemd.directives.7.gz
/usr/share/man/man7/systemd.special.7.gz

$ man -wK --regex 'emergency|critical|error'
/usr/share/man/overrides/man1/aide.1.gz
/usr/share/man/overrides/man1/iconv.1.gz
/usr/share/man/overrides/man1/locale.1.gz
/usr/share/man/overrides/man1/localedef.1.gz
/usr/share/man/man1/7z.1.gz
/usr/share/man/man1/7za.1.gz
/usr/share/man/man1/abrt-action-analyze-vmcore.1.gz
/usr/share/man/man1/abrt-action-check-oops-for-hw-error.1.gz
/usr/share/man/man1/abrt-auto-reporting.1.gz
/usr/share/man/man1/ac.1.gz
....

$ man -wK --regex 'emergency|critical|error' | wc -l
6419
This is what I got 6419 results. I know the search pattern I gave is OR operator. If only I knew how to give AND operator in the regex, I think it solve my problem.

Thanks
 
Old 12-08-2019, 09:27 AM   #6
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,161
Blog Entries: 6

Rep: Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836
I'm going to do a very small example so it doesn't take forever.

Look for man pages with 'remote and shell' in the short descriptions and manual page names.
Code:
man -k 'remote.*shell'
rsh (1)              - Remote shell client
rshd (8)             - Remote shell server
Easy way to read/search those man pages
Code:
man -t rsh | ps2pdf - rsh.pdf
man -P cat rsh > rsh.txt
Use favorite pdf reader/text editor.

grep a man page for string
Code:
man rsh | grep -- '-d'
-d, --debug
 
Old 12-08-2019, 02:57 PM   #7
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,820

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by ArfaSmif View Post
man -k emergency
man -k critical
Which is, as a one-liner, can be done with "apropos emergency critical".

There's more than one way to skin this cat.
 
Old 12-08-2019, 09:33 PM   #8
ArfaSmif
Member
 
Registered: Oct 2008
Location: Brisbane Australia
Distribution: Fedora, Centos, Manjaro
Posts: 317

Rep: Reputation: 70
Quote:
Originally Posted by rnturn View Post
Which is, as a one-liner, can be done with "apropos emergency critical".

There's more than one way to skin this cat.
I've always hated trying to type in the word "apropos". It's easier for me to use "man -k".
 
Old 12-10-2019, 12:51 PM   #9
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,161
Blog Entries: 6

Rep: Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836Reputation: 1836
Quote:
When I search for wincc 7 5
When you searched how?
Code:
man -k wincc 7 5 | wc -l
wincc: nothing appropriate.
1309

apropos wincc 7 5 | wc -l
wincc: nothing appropriate.
1309
1300 responses for 7 and 5. Don't search for numbers like that.
 
Old 12-10-2019, 01:06 PM   #10
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,766

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
Quote:
Originally Posted by Shituhin238 View Post
When I search for wincc 7 5
I get this message:
The following words in your search query were ignored because they are too common words: wincc 7 5.
What more should I write in the search field?
Spam link in sig. Reported.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
man not working if man pages are on NFS share ehereth Linux - Software 21 08-10-2018 02:06 PM
BLFS 8.1: OpenSP places man pages in usr/man jr_bob_dobbs Linux From Scratch 1 02-13-2018 07:23 PM
[SOLVED] man pages - man command phillyfilly Linux - Newbie 4 02-10-2014 05:41 AM
Search all man pages for a phrase suguru Linux - Software 1 09-12-2004 06:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration