5 Ways to Get Help in the Command Line of Mac OS X

Feb 24, 2007 - 3 Comments

Terminal in OS X

Whether you’re a unix novice or veteran to the terminal, if you’re using the command line you’ll often find yourself looking up exactly how to use a specific command for either its understanding the commands full functionality or just to discover the proper syntax. Many of us will just google a command if we can’t seem to get things to work properly, but before you go that route you can also try the available resources that are built right in to the Terminal.

There’s no shame in needing assistance or needing to reference a manual page, so here are five ways to get some help right in the command line of OS X. Because most of these tricks are native to the command line and not OS X specific, they will work on a Mac and many other unix variations too, like Linux.

5 Tricks to Get Instant Command Line Help in the Mac OS X Terminal

Command Action / Results
man (command) Display the manual page for (command). eg: man lsof
whatis (command) Display a one line brief summary of specified command. eg: whatis lsof
(command) --help Display command usage information including available flags and proper syntax. eg: lsof –help
apropos (string) Searches the whatis database for (string), helpful in finding commands. eg: apropos ssh
(command)+tab key Begin typing a command, and hit the tab key to autocomplete, or to list available commands that start with the typed prefix.

Note: be sure to remove the parenthesis () to get each command to work properly.

In all versions of unix, man(manual) pages are legitimately useful resources, particularly to obtain a broad understanding of a specific command when the –help flag trick isn’t sufficient, or apropos is too brief.

Man page launched within Terminal app for Mac OS X

Now, the next time your geeky coworker tells you to “RTFM”, you can school them on your knowledge that you learned from the builtin terminal resources.

Do you have another trick to get help in the OS X Terminal? Do you use man pages or the –help flag? Or maybe you just google the web for your question or problem like many of us tech workers do? They’re all valid tricks, but the advantage to those mentioned above is that they work offline too, which can be really handy in many situations. And for those interested in learning more about the command line in OS X, we have plenty of Terminal tips here!

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, How to, Mac OS X

3 Comments

» Comments RSS Feed

  1. You forgot : info

    INFO(1) User Commands INFO(1)

    NAME
    info – read Info documents

    SYNOPSIS
    info [OPTION]… [MENU-ITEM…]

    DESCRIPTION
    Read documentation in Info format.

    EXAMPLES
    info show top-level dir menu

    info emacs
    start at emacs node from top-level dir

    info emacs buffers
    start at buffers node within emacs manual

    info –show-options emacs
    start at node with emacs’ command line options

    info -f ./foo.info
    show file ./foo.info, not searching dir

  2. jared says:

    that is great so is the info command but I don’t understand the purpose of apropos and what it possibly does

  3. Chris says:

    Let’s say you’re programming and need to look up information regarding sockets, but socket(3) didn’t provide the information you are looking for.

    Doing ‘apropos socket’ will get you a list of _all_ manual pages talking about sockets, like accept(3), bind(3) and connect(3).

Leave a Reply

 

Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates