How do I find a Unix / Linux command?

Q. How do I find UNIX / Linux command for particular task?

A. You can do keyword based search under Linux / UNIX using man or apropos command.

apropos command

Each Linux / UNIX / BSD manual page has a short description available within it. apropos command searches the descriptions for instances of keyword. keyword is usually a regular expression (-r option), wildcards (-w option), or match the exact keyword (-e option). Using these options, it may be necessary to quote the keyword or escape (\) the special characters to stop the shell from interpreting them.

apropos examples

Find out all delete / removal related administrative commands:
$ apropos -s8 -w "*delete*"
Sample output:

addgroup (8cn)       - add and delete newsgroups, locally only
delgroup (8cn)       - add and delete newsgroups, locally only
groupdel (8)         - delete a group
userdel (8)          - delete a user account and related files

The -s option search only the given manual section. If section is a simple section, for example “3”, then the displayed list of descriptions will include pages in sections “3”, “3perl”, “3x”, and so on; while if section has an extension, for example “3perl”, then the list will only include pages in that exact part of the manual section. Following table highlights man page sections:

Section Meaning
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]

Find command that removes file:
$ apropos -r 'remove file'
Sample output:
rm (1) - remove files or directories
Search the short descriptions and manual page names for the keyword printf as regular expression:
$ apropos -r printf
Output:

aa_printf (3)        - print text to AA-lib output buffers.
asprintf (3)         - print to allocated string
cucul_printf (3caca) - (unknown subject)
dprintf (3)          - print to a file descriptor
fprintf (3)          - formatted output conversion
fwprintf (3)         - formatted wide-character output conversion
gl_printf (3)        - write formatted output in graphic mode
printf (1)           - format and print data
printf (3)           - formatted output conversion
snprintf (3)         - formatted output conversion
sprintf (3)          - formatted output conversion
swprintf (3)         - formatted wide-character output conversion
vasprintf (3)        - print to allocated string
vdprintf (3)         - print to a file descriptor
vfprintf (3)         - formatted output conversion
vfwprintf (3)        - formatted wide-character output conversion
vprintf (3)          - formatted output conversion
vsnprintf (3)        - formatted output conversion
vsprintf (3)         - formatted output conversion
vswprintf (3)        - formatted wide-character output conversion
vwprintf (3)         - formatted wide-character output conversion
wprintf (3)          - formatted wide-character output conversion

Read apropos man page for more information:
$ man apropos

Related: Linux commands to help you navigate


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 3 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
3 comments… add one
  • Ganesh May 9, 2008 @ 16:42

    Hi

    Super and very useful things i am getting here..
    Thanxs a lottttttttttttttt…

    good website…. knowledge centr anyone can easily understand and use it

  • thx May 10, 2008 @ 3:11

    Thanks you for the apropos cmd.
    Usually, I used “man -k keywordhere” but apropos looks really much nicer.

  • Jake Jun 15, 2008 @ 4:01

    Thank you for this information… I never knew this was possible. I have always Googled through online man pages. This is much more efficient.

    I have now set up an alias with a note to this page. Thanks again!

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum