Post History
Unix filters are quite handy. First of all, you can get an index of any manual page with a simple grep(1): $ man pacman | grep '^[^ ]' PACMAN(8) Pacman Manual ...
Answer
#4: Post edited
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- If you also want to see subsections, you can expand that *grep*(1) a little bit:
- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- With more powerful scripts, you'll be able to do more powerful selections.
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- If you also want to see subsections, you can expand that *grep*(1) a little bit:
- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- The above script only works with man(7) pages. mdoc(7) pages will need a slightly different (but very similar) script.
- With more powerful scripts, you'll be able to do more powerful selections.
#3: Post edited
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- If you also want to see subsections, you can expand that *grep*(1) a little bit:
- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
| groff -man -Tutf8\- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- With more powerful scripts, you'll be able to do more powerful selections.
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- If you also want to see subsections, you can expand that *grep*(1) a little bit:
- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- With more powerful scripts, you'll be able to do more powerful selections.
#2: Post edited
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
If you also want to see subsections, you can expang that *grep*(1) a little bit:- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8\
- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- With more powerful scripts, you'll be able to do more powerful selections.
- Unix filters are quite handy.
- First of all, you can get an index of any manual page with a simple *grep*(1):
- ```sh
- $ man pacman | grep '^[^ ]'
- PACMAN(8) Pacman Manual PACMAN(8)
- NAME
- SYNOPSIS
- DESCRIPTION
- OPERATIONS
- OPTIONS
- TRANSACTION OPTIONS (APPLY TO -S, -R AND -U)
- UPGRADE OPTIONS (APPLY TO -S AND -U)
- QUERY OPTIONS (APPLY TO -Q)
- REMOVE OPTIONS (APPLY TO -R)
- SYNC OPTIONS (APPLY TO -S)
- DATABASE OPTIONS (APPLY TO -D)
- FILE OPTIONS (APPLY TO -F)
- HANDLING CONFIG FILES
- EXAMPLES
- CONFIGURATION
- SEE ALSO
- BUGS
- AUTHORS
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- If you also want to see subsections, you can expand that *grep*(1) a little bit:
- ```sh
- $ man rsync | grep -e '^[^ ]' -e '^ [^ ]'
- rsync(1) User Commands rsync(1)
- NAME
- SYNOPSIS
- DESCRIPTION
- GENERAL
- SETUP
- USAGE
- COPYING TO A DIFFERENT NAME
- SORTED TRANSFER ORDER
- MULTI‐HOST SECURITY
- ADVANCED USAGE
- CONNECTING TO AN RSYNC DAEMON
- USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION
- STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS
- EXAMPLES
- OPTION SUMMARY
- OPTIONS
- DAEMON OPTIONS
- FILTER RULES
- SIMPLE INCLUDE/EXCLUDE RULES
- SIMPLE INCLUDE/EXCLUDE EXAMPLE
- FILTER RULES WHEN DELETING
- FILTER RULES IN DEPTH
- PATTERN MATCHING RULES
- FILTER RULE MODIFIERS
- MERGE‐FILE FILTER RULES
- LIST‐CLEARING FILTER RULE
- ANCHORING INCLUDE/EXCLUDE PATTERNS
- PER‐DIRECTORY RULES AND DELETE
- TRANSFER RULES
- BATCH MODE
- SYMBOLIC LINKS
- DIAGNOSTICS
- EXIT VALUES
- ENVIRONMENT VARIABLES
- FILES
- SEE ALSO
- BUGS
- VERSION
- INTERNAL OPTIONS
- CREDITS
- THANKS
- AUTHOR
- rsync 3.2.7 20 Oct 2022 rsync(1)
- ```
- If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8).
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8;
- PACMAN(8) Pacman Manual PACMAN(8)
- SYNC OPTIONS (APPLY TO -S)
- -c, --clean
- Remove packages that are no longer installed from the cache as well
- as currently unused sync databases to free up disk space. When
- pacman downloads packages, it saves them in a cache directory. In
- addition, databases are saved for every sync DB you download from
- and are not deleted even if they are removed from the configuration
- file pacman.conf(5). Use one --clean switch to only remove packages
- that are no longer installed; use two to remove all files from the
- cache. In both cases, you will have a yes or no option to remove
- packages and/or unused downloaded databases.
- If you use a network shared cache, see the CleanMethod option in
- pacman.conf(5).
- -g, --groups
- Display all the members for each package group specified. If no
- group names are provided, all groups will be listed; pass the flag
- twice to view all groups and their members.
- -i, --info
- Display information on a given sync database package. Passing two
- --info or -i flags will also display those packages in all
- repositories that depend on this package.
- -l, --list
- List all packages in the specified repositories. Multiple
- repositories can be specified on the command line.
- -q, --quiet
- Show less information for certain sync operations. This is useful
- when pacman’s output is processed in a script. Search will only
- show package names and not repository, version, group, and
- description information; list will only show package names and omit
- databases and versions; group will only show package names and omit
- group names.
- -s, --search <regexp>
- This will search each package in the sync databases for names or
- descriptions that match regexp. When you include multiple search
- terms, only packages with descriptions matching ALL of those terms
- will be returned.
- -u, --sysupgrade
- Upgrades all packages that are out-of-date. Each
- currently-installed package will be examined and upgraded if a
- newer package exists. A report of all packages to upgrade will be
- presented, and the operation will not proceed without user
- confirmation. Dependencies are automatically resolved at this level
- and will be installed/upgraded if necessary.
- Pass this option twice to enable package downgrades; in this case,
- pacman will select sync packages whose versions do not match with
- the local versions. This can be useful when the user switches from
- a testing repository to a stable one.
- Additional targets can also be specified manually, so that -Su foo
- will do a system upgrade and install/upgrade the "foo" package in
- the same operation.
- -y, --refresh
- Download a fresh copy of the master package database from the
- server(s) defined in pacman.conf(5). This should typically be used
- each time you use --sysupgrade or -u. Passing two --refresh or -y
- flags will force a refresh of all package databases, even if they
- appear to be up-to-date.
- Pacman 6.0.2 2023-08-16 PACMAN(8)
- ```
- (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.)
- ```sh
- $ man -w pacman \
- | xargs zcat \
- | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \
- 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \
- -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \
- | groff -man -Tutf8\
- | mandoc -Tutf8 2>/dev/null \
- | col -pbx;
- ```
- The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages.
- Here's the original code (see the `man_section()` function):
- <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases>
- With more powerful scripts, you'll be able to do more powerful selections.
#1: Initial revision
Unix filters are quite handy. First of all, you can get an index of any manual page with a simple *grep*(1): ```sh $ man pacman | grep '^[^ ]' PACMAN(8) Pacman Manual PACMAN(8) NAME SYNOPSIS DESCRIPTION OPERATIONS OPTIONS TRANSACTION OPTIONS (APPLY TO -S, -R AND -U) UPGRADE OPTIONS (APPLY TO -S AND -U) QUERY OPTIONS (APPLY TO -Q) REMOVE OPTIONS (APPLY TO -R) SYNC OPTIONS (APPLY TO -S) DATABASE OPTIONS (APPLY TO -D) FILE OPTIONS (APPLY TO -F) HANDLING CONFIG FILES EXAMPLES CONFIGURATION SEE ALSO BUGS AUTHORS Pacman 6.0.2 2023-08-16 PACMAN(8) ``` If you also want to see subsections, you can expang that *grep*(1) a little bit: ```sh $ man rsync | grep -e '^[^ ]' -e '^ [^ ]' rsync(1) User Commands rsync(1) NAME SYNOPSIS DESCRIPTION GENERAL SETUP USAGE COPYING TO A DIFFERENT NAME SORTED TRANSFER ORDER MULTI‐HOST SECURITY ADVANCED USAGE CONNECTING TO AN RSYNC DAEMON USING RSYNC‐DAEMON FEATURES VIA A REMOTE‐SHELL CONNECTION STARTING AN RSYNC DAEMON TO ACCEPT CONNECTIONS EXAMPLES OPTION SUMMARY OPTIONS DAEMON OPTIONS FILTER RULES SIMPLE INCLUDE/EXCLUDE RULES SIMPLE INCLUDE/EXCLUDE EXAMPLE FILTER RULES WHEN DELETING FILTER RULES IN DEPTH PATTERN MATCHING RULES FILTER RULE MODIFIERS MERGE‐FILE FILTER RULES LIST‐CLEARING FILTER RULE ANCHORING INCLUDE/EXCLUDE PATTERNS PER‐DIRECTORY RULES AND DELETE TRANSFER RULES BATCH MODE SYMBOLIC LINKS DIAGNOSTICS EXIT VALUES ENVIRONMENT VARIABLES FILES SEE ALSO BUGS VERSION INTERNAL OPTIONS CREDITS THANKS AUTHOR rsync 3.2.7 20 Oct 2022 rsync(1) ``` If you want to read only one of those sections, you can script a little bit more. Let's say you're only interested in the SYNC OPTIONS from *pacman*(8). ```sh $ man -w pacman \ | xargs zcat \ | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \ 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \ -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \ | groff -man -Tutf8; PACMAN(8) Pacman Manual PACMAN(8) SYNC OPTIONS (APPLY TO -S) -c, --clean Remove packages that are no longer installed from the cache as well as currently unused sync databases to free up disk space. When pacman downloads packages, it saves them in a cache directory. In addition, databases are saved for every sync DB you download from and are not deleted even if they are removed from the configuration file pacman.conf(5). Use one --clean switch to only remove packages that are no longer installed; use two to remove all files from the cache. In both cases, you will have a yes or no option to remove packages and/or unused downloaded databases. If you use a network shared cache, see the CleanMethod option in pacman.conf(5). -g, --groups Display all the members for each package group specified. If no group names are provided, all groups will be listed; pass the flag twice to view all groups and their members. -i, --info Display information on a given sync database package. Passing two --info or -i flags will also display those packages in all repositories that depend on this package. -l, --list List all packages in the specified repositories. Multiple repositories can be specified on the command line. -q, --quiet Show less information for certain sync operations. This is useful when pacman’s output is processed in a script. Search will only show package names and not repository, version, group, and description information; list will only show package names and omit databases and versions; group will only show package names and omit group names. -s, --search <regexp> This will search each package in the sync databases for names or descriptions that match regexp. When you include multiple search terms, only packages with descriptions matching ALL of those terms will be returned. -u, --sysupgrade Upgrades all packages that are out-of-date. Each currently-installed package will be examined and upgraded if a newer package exists. A report of all packages to upgrade will be presented, and the operation will not proceed without user confirmation. Dependencies are automatically resolved at this level and will be installed/upgraded if necessary. Pass this option twice to enable package downgrades; in this case, pacman will select sync packages whose versions do not match with the local versions. This can be useful when the user switches from a testing repository to a stable one. Additional targets can also be specified manually, so that -Su foo will do a system upgrade and install/upgrade the "foo" package in the same operation. -y, --refresh Download a fresh copy of the master package database from the server(s) defined in pacman.conf(5). This should typically be used each time you use --sysupgrade or -u. Passing two --refresh or -y flags will force a refresh of all package databases, even if they appear to be up-to-date. Pacman 6.0.2 2023-08-16 PACMAN(8) ``` (If you want to get rid of the formatting, you can replace groff by mandoc in the pipeline.) ```sh $ man -w pacman \ | xargs zcat \ | pee 'sed -n "/^\.TH/,/^\.SH/{/^\.SH/!p}"' \ 'sed -n -e "/^\.SH \"\?SYNC OPTIONS/p" \ -e "/^\.SH \"\?SYNC OPTIONS/,/^\.SH/{/^\.SH/!p}"' \ | groff -man -Tutf8\ | mandoc -Tutf8 2>/dev/null \ | col -pbx; ``` The origin of this script is in fact in the Linux man-pages repository (it's a bit different, as I deal with uncompressed pages, and often want to read the same section in several pages in the same directory). I've used it for reviewing changes to the pages. Here's the original code (see the `man_section()` function): <https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/scripts/bash_aliases> With more powerful scripts, you'll be able to do more powerful selections.