brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: man -k searches every man page description in your terminal

Terminal
~/tips/tip-terminal-man-k-apropos

man -k checksum

Finds the command you need when you only know what it should do.

You know there is a tool for checksums, or for changing a file’s flags, but not its name. The man pages can be searched by keyword.

man -k, the same thing as apropos, searches the one line description of every installed man page:

man -k checksum

On a Mac that answers with lines like cksum(1), sum(1) - display file checksums and block counts and the shasum family. The number in brackets is the section: 1 for user commands, 5 for file formats, 8 for system administration.

The search is a pattern, so you can narrow it. To see only commands, and not the C library functions with the same word in them, ask for section 1:

apropos -s 1 checksum
man -k crontab

The second one shows crontab(1) for the command and crontab(5) for the file format, which is usually the page you were after. Open that one with man 5 crontab.

The result is only as good as the descriptions. A search for zip finds zip, but a search for compress may miss tools whose description says something else. I’d try a second word before deciding a tool doesn’t exist. On Linux, if man -k says nothing appropriate for everything, the index is missing and sudo mandb builds it.

Further reading: apropos(1) Linux manual page, man man page (macOS)

More Terminal tips ioreg -rn AppleSmartBattery | grep CycleCount Terminal can save your windows and tabs as a window group Export a Terminal profile to a .terminal file and import it on another Mac mc hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x700000039,"HIDKeyboardModifierMappingDst":0x700000029}]}' All Terminal tips (116) All topics

Link