-1

How am I supposed to explore all of the commands available in my terminal? I'd like to be able to browse all commands/documentation that is currently documented within the man command, how do I do that?

10
  • 3
    Does this answer your question? How do you output a list of all man pages in a particular section? ... just omit the section filter. – muru Feb 26 '20 at 3:57
  • how do I find a list of all sections? – iggy12345 Feb 26 '20 at 4:02
  • 1
    @jsotola what in particular am I supposed to be looking at? The /usr/share/man directory? One of the global variables? – iggy12345 Feb 26 '20 at 4:10
  • 3
    Maybe the task of "exploring all the commands available" is not really feasible in a systematic way. In most cases, you will stumble across a task to accomplish and then search for a way so solve it, e.g. by using apropos <keyword> to look for any man page relating to the "keyword" you are looking for (or searching here/on the web if that fails). If you really want to browse the entire documentation, you might want to look at the info system (if it is installed - you didn't specify your OS flavour and version). Simply type info on the console, it will give you a linked menu. – AdminBee Feb 26 '20 at 9:25
  • 1
    On Linux Mint, this does it: ( cd /usr/share/man && find 2>/dev/null man{1..7} -type f -name '*.gz' | awk '-F[.]' '{ print $1 }' | sort ). I get 4000 man pages listed. – Paul_Pedant Feb 26 '20 at 9:54
2

I get 4000 man pages listed

That is half of the problem. OP wants not only:

]# apropos -s1       
apropos what?
]# apropos -s1 -w \*

which gives a good flat list of commands. But what about builtins, coreutils, sbin?

And it is not the commands alone he wants:

"all commands/documentation"

A lot of important info is in other sections: 4, 5, 7 or 8.

There is no starting point. There is no "User's Manual" with a list of commands. The manual is a list of commands, and the commands also are only building blocks. echo and gcc are side by side with a lot of explanations. But to find out what they are for is not so easy for a newbie. (my role model newbie is just an interested 13 year old boy - or girl)


The way linux distributions are made the packages should be the main structuring names: they naturally group some commands together. And packages always have a good description.

This is some man-files from systemd not beginning with "systemd-"

systemd /usr/share/man/man5/udev.conf.5.gz
systemd /usr/share/man/man5/user-runtime-dir@.service.5.gz
systemd /usr/share/man/man5/user.conf.d.5.gz
systemd /usr/share/man/man5/user@.service.5.gz
systemd /usr/share/man/man5/vconsole.conf.5.gz
systemd /usr/share/man/man7/
systemd /usr/share/man/man7/bootup.7.gz
systemd /usr/share/man/man7/daemon.7.gz
systemd /usr/share/man/man7/file-hierarchy.7.gz
systemd /usr/share/man/man7/hwdb.7.gz
systemd /usr/share/man/man7/kernel-command-line.7.gz
systemd /usr/share/man/man7/sd-boot.7.gz
systemd /usr/share/man/man7/udev.7.gz
systemd /usr/share/man/man8/
systemd /usr/share/man/man8/kernel-install.8.gz

and the man1 part:

systemd /usr/share/man/man1/
systemd /usr/share/man/man1/bootctl.1.gz
systemd /usr/share/man/man1/busctl.1.gz
systemd /usr/share/man/man1/coredumpctl.1.gz
systemd /usr/share/man/man1/hostnamectl.1.gz
systemd /usr/share/man/man1/init.1.gz
systemd /usr/share/man/man1/journalctl.1.gz
systemd /usr/share/man/man1/localectl.1.gz
systemd /usr/share/man/man1/loginctl.1.gz
systemd /usr/share/man/man1/machinectl.1.gz
systemd /usr/share/man/man1/networkctl.1.gz
systemd /usr/share/man/man1/portablectl.1.gz
systemd /usr/share/man/man1/resolvectl.1.gz
systemd /usr/share/man/man1/systemctl.1.gz
systemd /usr/share/man/man1/timedatectl.1.gz

This is a compact overview indepndent of the contents.

Other important packages are coreutils, util-linux, shell(s), editor(s).

If I want to find out about other commands related to ps, I can look at other commands from it's package (excerpt):

procps-ng /usr/share/man/man1/ps.1.gz
procps-ng /usr/share/man/man1/pwdx.1.gz
procps-ng /usr/share/man/man1/slabtop.1.gz
procps-ng /usr/share/man/man1/tload.1.gz
procps-ng /usr/share/man/man1/top.1.gz

And the description is "Utilities for monitoring your system and its processes" which gives the whole gang a meaningful title.

20 packages with 20 man pages each (average) is much better than 4000 man pages en bloque.


... and with syscalls

I did/am doing something similar with syscall-definitions I found (with find/grep).


The find -exec grep is (slightly formatted on two lines):

]# dlist='kernel mm fs block net ipc security' 
]# find $dlist -name '*.c' -exec grep '^SYSCALL_DEFINE[0-6]' {} +  

The $dlist is optional, but the full Giga (drivers/ !) will stir up the SSD for a few seconds the first time.

And by redirecting to some file by appending > /tmp/SYSC_06 I get a list which I can grep, sort and group by dir, filename and number of arguments. Some simple examples follow:


]# grep '(.*write.*,' SYSC_06 

mm/process_vm_access.c:SYSCALL_DEFINE6(process_vm_writev, pid_t, pid,
fs/read_write.c:SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
fs/read_write.c:SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf,
fs/read_write.c:SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
fs/read_write.c:SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
fs/read_write.c:SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec,


]# grep sync SYSC_06

mm/msync.c:SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)
fs/sync.c:SYSCALL_DEFINE0(sync)
fs/sync.c:SYSCALL_DEFINE1(syncfs, int, fd)
fs/sync.c:SYSCALL_DEFINE1(fsync, unsigned int, fd)
fs/sync.c:SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
fs/sync.c:SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes,
fs/sync.c:SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags,

This would be even more synoptical:

fs/sync.c: sync()
fs/sync.c: syncfs(fd)

"SEE ALSO" is useful, but I want to "SEE ALL" in logical groups

man futex has:

SEE ALSO: get_robust_list(2), restart_syscall(2), ...

But I get:

]# grep futex SYSC_06 

kernel/futex.c:SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head,
kernel/futex.c:SYSCALL_DEFINE3(get_robust_list, int, pid,
kernel/futex.c:SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,

(the lines are incomplete...but see above...the search is also not precise. )

restart_syscall() is for "internal use only" - quite a false trail.


Or all the syscalls with 6 arguments, minimally formatted:

]# grep FINE6 SYSC_06 |sed -n 's/(/\t\t/p'

kernel/futex.c:SYSCALL_DEFINE6          futex, u32 __user *, uaddr, int, op, u32, val,
kernel/fork.c:SYSCALL_DEFINE6           clone, unsigned long, clone_flags, unsigned long, newsp,
mm/nommu.c:SYSCALL_DEFINE6              mmap_pgoff, unsigned long, addr, unsigned long, len,
mm/mempolicy.c:SYSCALL_DEFINE6          mbind, unsigned long, start, unsigned long, len,
mm/mmap.c:SYSCALL_DEFINE6               mmap_pgoff, unsigned long, addr, unsigned long, len,
mm/process_vm_access.c:SYSCALL_DEFINE6          process_vm_readv, pid_t, pid, const struct iovec __user *, lvec,
mm/process_vm_access.c:SYSCALL_DEFINE6          process_vm_writev, pid_t, pid,
mm/migrate.c:SYSCALL_DEFINE6            move_pages, pid_t, pid, unsigned long, nr_pages,
fs/eventpoll.c:SYSCALL_DEFINE6          epoll_pwait, int, epfd, struct epoll_event __user *, events,
fs/read_write.c:SYSCALL_DEFINE6         preadv2, unsigned long, fd, const struct iovec __user *, vec,
fs/read_write.c:SYSCALL_DEFINE6         pwritev2, unsigned long, fd, const struct iovec __user *, vec,
fs/read_write.c:SYSCALL_DEFINE6         copy_file_range, int, fd_in, loff_t __user *, off_in,
fs/splice.c:SYSCALL_DEFINE6             splice, int, fd_in, loff_t __user *, off_in,
fs/select.c:SYSCALL_DEFINE6             pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
fs/aio.c:SYSCALL_DEFINE6                io_pgetevents,
net/socket.c:SYSCALL_DEFINE6            sendto, int, fd, void __user *, buff, size_t, len,
net/socket.c:SYSCALL_DEFINE6            recvfrom, int, fd, void __user *, ubuf, size_t, size,
ipc/syscall.c:SYSCALL_DEFINE6           ipc, unsigned int, call, int, first, unsigned long, second,
5
  • running apropos -s1 -w\* returns apropos: invalid option -- '*' – iggy12345 Feb 26 '20 at 13:20
  • @iggy12345: very true: both -w \* and -w '*' work, but both need a space. – user373503 Feb 26 '20 at 13:30
  • ... My honest error (didn't run that command so I could copypaste ;) - shows what tricks you need to get all entries. Thank you! I corrected. – user373503 Feb 26 '20 at 13:38
  • It's all good. These are great, thank you! But one more thing, when I run grep '(.*write.*,' SYSC_06 It says that there is no file or directory SYSC_06? – iggy12345 Feb 26 '20 at 13:45
  • find kernel mm fs block net ipc security -name '*.c' -exec egrep '^SYSC.*NE[0-6]' {} + gives the output from the top of a linux source tree. (I list the dirs to leave out drivers). It works because of the SYSCALL_DEFINEx() macros which are easy to find and grep (when you drop the second line...). The list can be processed in many ways so I stored these 386 lines on my tmpfs. I was concentrating on finding good examples. I will add some few words. Thank you for your interest! – user373503 Feb 26 '20 at 15:33
1

Why do you want to see "all manual pages"? As others have stated, on a typical desktop installation is its literally thousands. You can check the "user commands" in section 1 of the manual (sometimes also section l, for local additions/extraofficial commands), but those are at least several hundreds (here I've got 4365!).

Want to learn how to use the command line effectively? Check out a tutorial on your shell (presumably bash), there are many on the use of the command line, check out the Unix command line cheat sheet for the basic commands. Note that shells have rudimentary programming facilities, and a lot of gotchas that will bite you badly some day when writing more ambitious scripts. Use the programming facilities for one-shot throwaway commands (loop over al files called *.pdf and so), if your scripts grow/get used frequently, consider rewriting them in a sane scripting language (like Python). Learn how to use a "command line" text editor well, standard is vi (in Linux commonly really vim, a much extended version), but there are emacs fanatics... Many of the bog standard Unix commands (grep, more/less, sed) use more or less the same search machinery that vi uses, so it is a wise investment to learn how to use it (and if you someday find yourself stranded in a strange Unix system, vi will be available). Many commands pipe their voluminous output through your pager (more or less). There are commands to mangle text files (cat, cut, join, sort, split, head, tail).

For more specialized tasks, you'll have to see what is available (first look around with apropos to see if some manual page mentions the search term, and might be relevant), search on the 'net for the task in your distribution, and in desperate cases ask around here. There will typically a bewildering variety of programs for a given task... and the selection will have to be personal (preferences, availability, standard or not, ease of use, ...).

2
  • Sometimes you just want to be able to peruse a list of commands and see what's out there, instead of spending time on Reddit, or here, it'd be nice to just browse through the man pages and learn something new. I won't always have access to the internet, which is why I restricted my question. – iggy12345 Feb 26 '20 at 23:39
  • @iggy12345, nothing bad with that (I must confess I've done that on occasion too). But there is much (as a I said, some 4000 commands here on my workstation; I do have some rather exotic tools installed, true, but perhaps a few dozen of them if so many). Better get a solid (enough) understanding of the workings of your shell, the existence of the text mangling commands, an editor, and you are set. Do learn how to find what is useful for a given task, that is critical. Nobody can know all of the 1000 "most used" commands. Not really. – vonbrand Feb 27 '20 at 0:25
0

I don't have GMP installed, but I suspect the package does not contain man pages for it.

I'm not clear why you require man pages without using the internet, which you clearly have access to. The GMP project documentation is at :

https://gmplib.org/manual

There is a 150-page PDF at:

gmplib.org/gmp-man-6.2.0.pdf

Not the answer you're looking for? Browse other questions tagged or ask your own question.