Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Comments on How to RTFM well to get a CLI command

Parent

How to RTFM well to get a CLI command

+6
−0

I've been met with the phrase RTFM often. I recognize its value. However, the manual pages are often hard to understand and written by people who know so much about the topic at hand that they don't even realize how far away they are from a layman trying to use it.

How can I RTFM to use a command well, and how can I recognize if the man is the tool for the job (and what is, then: apropos, built-in help, info or something else?)? How can I "parse" man-pages quickly?

Since this is a part of Linux Basics Compendium, I'd like to stay only on-topic of common GNU/Linux commands, present in the common distributions.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

Related (1 comment)
Post
+3
−0

The pager

less(1)

less(1) is the usual pager nowadays; you would do well learning to use it. It's also used for paging the manual pages, in most systems. The most common operation is searching, which is done by pressing /. Press h within the pager, or run less --help to read its help for interactive use of the pager.

While reading a manual page, I often find myself searching for specific options of a command. Imagine I want to search for the option -type of find(1). I type /^ *-type (or being lazy, I often type / -type --at least three spaces between / and -; this forum collapses multiple spaces--).


Filtering

grep(1)

It may be useful to produce an index of a manual page:

$ man ldd | grep -e '^ \{0,3\}[^ ]' -e '^ \{4,7\}-'
ldd(1)                      General Commands Manual                     ldd(1)
NAME
SYNOPSIS
DESCRIPTION
   Security
OPTIONS
     --version
     --verbose
     -v     Print  all  information, including, for example, symbol versioning
     --unused
     -u     Print unused direct dependencies.  (Since glibc 2.3.4.)
     --data-relocs
     -d     Perform relocations and report any missing objects (ELF only).
     --function-relocs
     -r     Perform relocations for both data objects and functions,  and  re‐
     --help
BUGS
SEE ALSO
Linux man‐pages (unreleased)        (date)                              ldd(1)

You can use more complex filters to, for example, read only a specific section(s) of a manual page.


whatis(1) vs apropos(1)

Both programs display the name of some pages, followed by a short description of them (it is the NAME (or Name) section of the manual page that these commands print). They differ in what they find.

whatis(1)

You ask what is a term (a command, a C function, ...), and it tells you a short description.

This program searches for manual pages whose name matches the term you specified.

apropos(1)

This program searches both the name of pages and their short description for the term you specified. It's more like "I'm not sure what I'm searching for, please show me anything that resembles this".


Other documentation formats

info(1)

info(1) is an alternative system, much more complex than man(1). The GNU project doesn't like manual pages, and developed their own documentation format, and formatter. GNU programs always have info(1) documentation, and often (but not always) they also have manual pages. Non-GNU projects tend to only have manual pages.

I read their manual pages, unless I don't find what I'm looking for, in which case I look at their info(1) manual.

If you find info(1) difficult to use, you can pipe it to less(1) to read it all in one take, as if it were a manual page:

info printf | less

help(1)

Shells usually provide a help(1) command that documents the built-ins of the shell. This is the case with read, cd, ... There's no binary program being run, but rather a built-in function within the shell; this can optimize some common operations, or in some cases it's impossible to implement some functionality in the form of a binary program (e.g., cd).

Most of these built-ins are defined by POSIX, so you can still read the POSIX manual page for the utility (install manpages-posix on Debian).

tldr(1)

These pages present short and common examples with a short explanation. Sometimes it's easier to start reading examples rather than trying to read a descriptive page. On Debian, apt-get install tldr; then, for example, use tldr tar to read examples of use of tar(1).

https://tldr.sh/

Interactive programs

In interactive programs, there's usually a key that shows the help of the program, reminding you the keys for the interactive commands of the program. less(1) uses h; mutt(1) uses ?. h and ? are common keys for that.

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Works for me (1 comment)
Works for me
LAFK‭ wrote about 1 year ago

Very comprehensive, tldr is a splendid addition, so is the explanation on whatis vs apropos, this readily gives me a running start