[TynesideLUG] Digging around man pages.
Ian Bruntlett
ian.bruntlett at gmail.com
Sun Jul 11 16:38:21 UTC 2021
Hi,
I've been digging around and wanted to get a list of system calls - but I
needed a way to get that info, despite not knowing what all the system
calls names were.
So I played around with apropos (later, man -k) and came up with a command
to do that. I couldn't remember what all the section numbers for man mean
either. So I came up with a shell script to do both for me.
If you run the shellscript from below as ./man-section 2 it does that. If
you want everything, then ./man-section {1..9} will do it but I get a
strange warning message...
Have fun!
Ian
#!/usr/bin/env bash
# 2021-07-11 Ian Bruntlett
# Name : man-section
# Purpose: To dig around the man pages
function Usage
{
echo Usage: "$0 section-number (from 1 to 9, optional)"
cat <<END-OF-SECTION-LIST
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions, e.g. /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g.
man(7),
groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
END-OF-SECTION-LIST
}
if [ $# -eq 0 ]; then
Usage >&2
exit 0
fi
while [ "$1" != "" ]; do
man -k "[a-z]" -s "$1"
shift
done
--
-- ACCU - Professionalism in programming - http://www.accu.org
-- My writing - https://sites.google.com/site/ianbruntlett/
-- Free Software page -
https://sites.google.com/site/ianbruntlett/home/free-software
More information about the Tyneside
mailing list