4 ms·
Apologies. Tangent: What does the (1) mean beside dd? I see this with man pages. Is it a version identifier? Edit: thank you both for taking the time to shar
by Waterluvian 4y ago
Apologies. Tangent:
What does the (1) mean beside dd? I see this with man pages. Is it a version identifier?
Edit: thank you both for taking the time to share. I appreciate the quick response.
- colejohnson66 4y agoThe “section”[0] or “subpage.” Programs are section 1, hence ‘dd(1)’ The idea is that it can be possible for a library function (section 3) to have the same name as an executable. In which case, you’d type into your shell: man 1 <name> # executable: <name>(1) man 3 <name> # function: <name>(3) Without the distinction argument, man will throw its arms up in the air and give up. However, if there’s no ambiguity (such as with ‘dd’ where only the executable exists), you can drop the section number parameter when running man. man will then search all the sections, see that ‘dd’ only exists in section 1, and go from there. [0]: https://linux.die.net/man/ https://linux.die.net/man/
- dredmorbius 4y agoCorrect. I also use the notation as a convention to indicate that I'm referring to a Unix command (or library function, etc.). E.g., "cat" might refer to a feline, but "cat(1)" should more clearly refer to the Unix / Linux command. (Where I've got proper markup, I'll typically set commands or references in monospace using backtick notation: `dd`, `cat`, etc.
- NAR8789 4y agoWhat do you do if you need to unambiguously refer to cat-as-in-feline?
- eesmith 4y agocat (Felis catus) ;)
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- dredmorbius 4y agoI show claws.
- CRConrad 4y ago> Where I've got proper markup, I'll typically set commands or references in monospace You can do that here by putting them on a separate line (two newlines, separate paragraph) and indenting by a couple characters.
- zengargoyle 4y agoSomething like `read` gives a better example. Like `man 1 read` is "read — read from standard input into shell variables", "read [-r] var...", a shell function. And `man 2 read` is " read - read from a file descriptor", "ssize_t read(int fd, void buf, size_t count);". You can also get into `man 8 catman`, "catman - create or update the pre-formatted manual pages", "catman [-d?V] [-M path] [-C file] [section] ...". The `catman` is a mirror-like hierarchy of man pages (usually in troff format using the 'an' macro package) pre-formatted for the standard terminal or whatever to shave off a bit of time running roff on the source files all the time. This is all ancient knowledge and well in place back in the mid 1980's long before Linux or any of that stuff. The `man` page sections used to be different 3-ring binders all printed out sitting on a table in the computer lab. The 'sections' were just different binders of documentation. Get off my lawn!!!
- jwilk 4y ago> Without the distinction argument, man will throw its arms up in the air and give up. At least in man-db and FreeBSD implementations, it actually shows you the first page it found by default.
- colejohnson66 4y agoYou're correct; I thought that might've been wrong... I just tested, and `man man` opened man(1) despite man(7) existing.
- OJFord 4y agoOr config in 5 is another perhaps more likely to come across as a user.
- xigoi 4y agoWhy is it random numbers rather than readable words? man exe <name> man lib <name>
- karatinversion 4y agoAs I understand it, because it descends from printed manuals with numbered sections.
- colejohnson66 4y agoYep. Executables are section 1 simply because they came first in the binders. There's nothing necessarily preventing man from allowing string codes as a replacement, but man interprets (fully) non-numeric arguments as pages to go. So `man cat dd` (on Ubuntu) will first open cat(1), and when you exit (with 'q'), will prompt if you want to continue. If you say yes, it'll open dd(1). That has the side effect than `man exe dd` would be interpreted as opening exe(#) (printing "No manual entry for exe") followed by dd(1).
- nieve 4y agoMan pages are divided into sections as follows (GNU & Linux): 0 Header files (usually found in /usr/include) 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]
- Arnavion 4y agoAs explained in `man man`, of course.
- Maursault 4y ago
- masklinn 4y agoEr… what? GP’s comment should apply to most if not all systems with a few caveats / divergences. FreeBSD certainly mentions and lists standard sections at the top of `man man`. OpenBSD mentions the concept of categories / sections early on, though it only lists the specific section when it comes around to documenting the corresponding filter. GNU invented info(1), not man(1).
- Maursault 4y agoIt is just a pet peeve of mine that a lot of younger pros and devs talk about Linux as though it were groundbreaking, when all of GNU/Linux is a copy of a copy of a copy of a copy of the actual earth-shaking developments, SysV (arbitrary) and BSD. Everything in Linux was there before Linux was a twinkle in Linus' eye. I remember when most webservers ran NetBSD, and 5 years later Linux took over the data center. Was NetBSD really so intolerable and Linux really that superior? No, its just that with no memory of the past, one can't know any better. Linux really brought nothing new, no new advances, nothing that wasn't there before, and yet it took over like a jihad. That isn't accurate... not like a jihad... it was a jihad. We can thank fanaticism for Linux in the datacenter. I'm not unfaithful, just system-agnostic. Linux was a solution to a problem already solved many times. And since Linux is not original, it sort of gets under my skin when it is insinuated as such. When talking about any software, one should refer to its original development. When we talk about web browsers, we don't talk as though, say, Microsoft invented the web browser, just because it has one; instead we talk about Tim Berners-Lee, not a copy of a copy of a copy of his work.
- yjftsjthsd-h 4y agoPerhaps more directly to your question: Yes, as siblings note it is a manpage section number, but writing it like that is just a way to refer to programs; "cat" could be a feline, but "cat(1)" is a unix program. Oh, and it can disambiguate; printf(1) is a program you run from the shell, printf(3) is a C library function. IMO it's as much a cultural convention as anything.
- dredmorbius 4y agoPrecisely this, esp. the cat vs. cat(1) distinction (which I'd just addressed in another response).
- xelxebar 4y agoWhile we're on a tangent. Here's a quick way to list all man pages available on your system: $ man -k '' And if you just want to see the ones for high-level documentation (i.e. section 7), then $ man -s 7 -k '' does the trick. Sections 7 and 5, in particular, are full of hidden gems.
- klibertp 4y agoOn the topic of hidden gems. The info directory is frequently populated by default with manuals when you install a piece of software. These tend to be more in-depth and complete manuals then the man pages for the same tool. Just type `info` in a terminal and be amazed. Emacs has a convenient info viewer also, under `C-h i`.
- tingletech 4y agousually `info` only works on a GNU derived OS. `man -k` has worked on every flavor of unix I've met. edit: `man -k ''` might be a GNUism too. Just tried on a BSD derived OS and got back nothing.
- fsckboy 4y agothe other answers are good, but haven't quite covered the topic. the unix manual was commonly printed out, and these section numbers were a necessity for looking things up. Collation was section number, and then alphabetical when you were first introduced to unix, you sat down with the manual and read it.