Site Logo

Find something in man page

This guide shows how to navigate man pages using the man command. Everyone at some point in their Linux life has used it: the man command. However, while the man program itself appears to be rather simplistic in its construct, it has a few extra abilities than just simply scrolling through the page. This document hopes to help shed some light on these capabilities. Within these directories are some folders with the structure manX where X is the section number. For example, a standard man layout might look like so:.

SEE VIDEO BY TOPIC: Linux man command summary with examples

Content:
SEE VIDEO BY TOPIC: Guns N' Roses - Sweet Child O' Mine (Official Music Video)

Subscribe to RSS

Manual pages are the canonical type of documentation for Unix systems. They are a bit arcane, but for a technology several decades old, they've held up quite well. The arcane bit is the markup language. This is a brief tutorial on writing good manual pages, at least for the typical cases.

You'll be assumed to be familiar with reading manual pages already. There are actually many ways to produce manual pages. The man 1 command needs a file using troff 1 formatting commands. On Linux, groff , the GNU implementation of troff , is used.

The important thing is that the formatted page follows manpage typesetting and other conventions, so that readers can efficiently extract the needed information from them. This bit is important: manpages are reference documentation, intended to quickly answer questions like "what is the purpose of this command" or "is there an option to show more information about files". It has a macro facility, and several macro packages have been written for writing manual pages.

The most common of these is the -man one. Here's an example of a manpage, using that:. Save that in a file, called corrupt. The output should be approximately like this after a manual conversion to HTML to allow fonts :. You can additionally add three more pieces of information: the date of this revision of the manual page, where the program it documents came from, and the title of the whole book to which this page belongs to.

I pretty much never use the optional ones: keeping the date up to date is a pain, and the others are not all that useful for my personal projects. The NAME section declares the name of command that is being documented. It also gives a very brief explanation of what it does. These two parts are separated by backslash-dash. That's a magic combination, the man command requires it.

This section is the source for data for man -k searches. That's a useful feature, and it is good to pay a bit of attention to making the brief explanation as useful as possible. However, do keep it brief; having it be broken on several lines looks bad. It may be a sign of a badly designed program if the brief explanation is hard to write. The Debian and derivatives man implementation comes with lexgrog , which can verify that you get the NAME section right.

In this section, we give the user a summary of how the command line syntax of the program looks like. Font usage is important here, and carries information.

All the parts that are in bold are things that the user is expected to write verbatim. Italic indicates values the user is expected to fill in. Normal font is used for syntax meta-characters: for the brackets that indicate optionality, and the ellipsis that indicates repetition. Fonts can be set in two ways: either using the dot-commands, or the backslash-f escapes. B command where the dot is at the beginning of a line typesets the rest of the line in bold face.

I typesets in italics but terminals show that as underline , and. R in what troff calls the roman font, and the rest of us call the normal font. You can combine these,. BR typesets the first word on the line in bold, the second in normal font. The output will have no space between the words:. BR manpagename 7 would be the usual way to refer to another manual page. If a word has spaces in it, use double quotes:. B "far and away" for example.

Backslash-f escapes work anywhere on a line, and sometimes they're easier to use than the dot-commands. Their effect also does not end at the end of a line. An unfortunate bit of arcane syntax is that dashes in options should be prefixed by backslashes.

The Debian and Ubuntu implementation of man treats them the same, for terminal output, but this is not portable. Typographically these are distinct, and they are also distinct in Unicode. The typesetter is free to break a line at a hyphen, but not at a minus. For dashes in options, you should thus use minuses, but in normal text, for normal words, the hyphen. There are no artificial size limits here, but it's still good style to avoid being long-winded. At the same time, it is perhaps best to not be quite as terse as the example.

If you write more than one paragraph, start the other paragraphs with the. PP command. Do not just leave an empty line; this makes troff sometimes do the wrong thing. In fact, the manual page source should have no empty lines at all.

This lets it typeset end-of-sentence whitespace better, when it produces output using proportional fonts. Also, this makes it easier to compare versions of a manpage with diff.

Options are perhaps the most tedious part to document. It is also the part where proper formatting gives the most benefit to the reader. First, there is the list structure. This is achieved with the. TP command, which is kind of magic. It takes the next line, and does not indent it, and then indents the rest of the paragraph. This gives the nice indented-paragraph style that makes it easy to quickly scan even a long list of options to find the right one. That first, un-indented line describes the option, giving its name, and indicates if it gets an argument or not.

If there are several names for an option a long one, and a one-letter one, for example , they should be on the same line, separated by commas. The one-letter option name does not get the option argument, to keep things short. Sometimes advanced use is also useful to show, but basic use is almost always useful, because that's what people need most often.

Marking up examples of command line use is a bit tricky in manual pages. Here's an example of an example:. The backslash is used to show that the shell command line is broken into two physical lines, even if it is just one logical command.

This is fairly commonly needed in manual pages: the page width is usually only 80 monospace characters wide, and with margins and indentations there's often only about 60 or 65 characters per line in the example. Command line examples therefore need to be wrapped, and it's better to be done explicitly in the manual page source than letting the man program do it. This example used the -man macros for troff , since that is the most common way to write manual pages.

However, they are admittedly arcane at this point in history. They're pretty easy to write, but not nearly as convenient as, say, Perl POD markup, or DocBook markup see the refentry element. However, those other markup languages require conversion tools to produce a file that man can actually use, and the tools do not always properly follow the manpage formatting conventions.

Introduction Manual pages are the canonical type of documentation for Unix systems. Conventions in manual pages The important thing is that the formatted page follows manpage typesetting and other conventions, so that readers can efficiently extract the needed information from them.

IR file B corrupt modifies files by toggling a randomly chosen bit. Default is one bit. TH Every manual page should start by specifying its title:. NAME section. Using fonts Fonts can be set in two ways: either using the dot-commands, or the backslash-f escapes. Paragraphs and line structure If you write more than one paragraph, start the other paragraphs with the. More about fonts There are some more font conventions.

BR man-pages 7 filenames in italics See man-pages 7 for more details. Fonts are again used to clarify things: the name of the option including any dashes at the beginning is in bold any argument is in italic, but the equals sign if any is in normal font the comma between options is in normal font Comments in troff source troff also supports comments: start a line with.

BR printf 1 command:. PP Nifty, huh? A few new troff commands:. RS starts a relative margin indent: examples are more visually distinguishable if they're indented. RE ends the indent. Since troff uses backslash for fonts and other in-line commands, it needs to be doubled in the manual page source so that the output has one.

Other ways of creating manual pages This example used the -man macros for troff , since that is the most common way to write manual pages. SEE ALSO For more information about writing manual pages, see: man 7 , for the -man macros mdoc 7 , for an alternative set of troff macros man-pages 7 , for manpage structure and font conventions Branden Robinson's Debconf5 talk Other ways to create manual pages: perlpod 1 , for Perl POD markup and conversion asciidoc.

Tags: article.

How to Search Man Pages at the Command Line

Jump to navigation. It's easy to get into the habit of googling anything you want to know about a command or operation in Linux, but I'd argue there's something even better: a living and breathing, complete reference, the man pages , which is short for manual pages. The history of man pages predates Linux, all the way back to the early days of Unix. Man pages also have a reputation of being terse and, in a way, have a language of their own.

Search a folder hierarchy for filename s that meet a desired criteria: Name, Size, File Type - see examples. GNU find searches the directory tree rooted at each given file name by evaluating the given expression from left to right, according to the rules of precedence see Operators , until the outcome is known the left hand side is false for AND operations, true for OR , at which point find moves on to the next file name.

This file documents the GNU utilities for finding files that match certain criteria and performing various operations on them. This file documents the GNU utilities for finding files that match certain criteria and performing various actions on them. This manual shows how to find files that meet criteria you specify, and how to perform various actions on the files that you find. The principal programs that you use to perform these tasks are find , locate , and xargs.

GUI Methods

To submit a product bug or enhancement request, please visit the Bug Reporter page. Documentation Archive Developer Search. Sending feedback…. Please try submitting your feedback later. Thank you for providing feedback! Your input helps improve our developer documentation. How helpful is this document? How can we improve this document? Fix typos or links Fix incorrect information Add or update code samples Add or update illustrations Add information about

find(1) - Linux man page

Manual pages are the canonical type of documentation for Unix systems. They are a bit arcane, but for a technology several decades old, they've held up quite well. The arcane bit is the markup language. This is a brief tutorial on writing good manual pages, at least for the typical cases.

By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. It only takes a minute to sign up.

By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I'm looking for information on the -X option of curl. However, the documentation is quite lengthy and I have to scroll down for quite a long time to get to this option.

Linux man Command Tutorial for Beginners (8 Examples)

Command line users are undoubtedly familiar with man pages, or manual pages, that contain details, help , and documentation to specified commands and functions. Referencing a man page can be essential when trying to learn proper syntax or how a command works, but with how large some manual pages are it can be a real drag to scroll through the entire man page to try and find a relevant portion. Note the flag is a capital -K, the string can be anything. Any matches to the syntax in the current man page will be highlighted.

SEE VIDEO BY TOPIC: Mastering Linux Man Pages - A Definitive Guide

By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up. Patterns can be regular expressions , for example, you could search for the word "option" by typing. Another useful operation is Union , as in color colour , which finds every occurrence of either color or colour this is sometimes called boolean OR. If you are searching for strings containing some of these "reserved" characters like?

Finding Files

A very useful aspect of the Linux command line is that the documentation for almost all command line tools is easily accessible. These documents are known as man pages, and you can easily access them through the command line using the man command. In this tutorial, we will discuss the basics of man using some easy to understand examples. But before we do that, it's worth mentioning that all examples in this article have been tested on Ubuntu The man command gives users access to manual pages for command line utilities and tools. Following is the syntax of this command:. The basic usage of man is very simple - just run the command with the name of the tool whose reference manual you want to access.

find. -name '*.[ch]' -print0 | xargs -r -0 grep -l thing. For a fuller treatment of finding files whose contents match a pattern, see the manual page for grep.

Click here to browse the author's latest version of this document. Corrections and suggestions welcome! This HOWTO explains what you should bear in mind when you are going to write on-line documentation -- a so-called man page -- that you want to make accessible via the man 1 command. Throughout this HOWTO, a manual entry is simply referred to as a man page, regardless of actual length and without sexist intention. Why do we write documentation?

iOS Manual Pages

.

How to use a man page: Faster than a Google search

.

.

.

Introduction

.

.

Comments: 2
  1. Fem

    What necessary words... super, an excellent idea

  2. JoJolmaran

    Bravo, seems to me, is an excellent phrase

Thanks! Your comment will appear after verification.
Add a comment

© 2020 Online - Advisor on specific issues.