Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

List of terminal commands

From time to time new users ask where they can find a list of Terminal commands.

Clearly there are many possible replies to this but I like these four:

1 - Short list: http://ss64.com/osx/

2 - Long list: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/

3 - Use the excellent 'List pages' facility of ManOpen. Each item is a clickable hot link.

4 - Produce your own list:

Open Terminal and paste the following and then type return:

/usr/libexec/makewhatis

Wait for the prompt.

Paste the following and then type return;

apropos ' '

On a basic Leopard installation this produces over 4,000 lines with each line containing one or more manual references. If you want to use the list it may be best to set the terminal to 999 columns before you start. It is easy to page down (shift page-down several times) to the bottom, select all (cmd A), copy (cmd C) and paste into a fast text editor (I still use BBEdit Light).

It is possible, although the mass edits are not trivial, to make each item in this list a hot link with one of the following:

A - HTML: <a href="x-man-page://ls">ls</a> - opens the manual page for ls in your Terminal - should work with most browsers - perhaps try clicking it!

B - Manual page - pity the hot links don't work in the Terminal although they do with several other applications such as ManOpen - see groff_mdoc for further information.

.Dd
.Dt LIST OFLINKS
.Os
.Bl -item -compact
.It
List of Links
.It
.Xr whatis 1
- search the whatis database for complete words
.It
.Xr man 1
- list directory contents
.It
.Xr ls 1
- format and display the on-line manual pages
.It
.Xr groff_mdoc 7
- reference for groff's mdoc implementation
.El

Do others have better ways to view local manual pages with full scroll and hot links?

Xserve and two 733 MHz G4s with Leopard !, Mac OS X (10.5.8)

Posted on Apr 3, 2010 4:33 PM

Reply
32 replies

Apr 3, 2010 6:03 PM in response to Neville Hillyer

4 - Produce your own list:

Open Terminal and paste the following and then type return:

/usr/libexec/makewhatis

Wait for the prompt.

Paste the following and then type return;

apropos ' '

On a basic Leopard installation this produces over 4,000 lines with each line containing one or more manual references.

Minor point, but this will give you man pages on operating system calls, library functions, Perl routines, config file formats, etc..., where as your topic title is "List of terminal commands" 🙂

This might be closer to reality

apropos ' ' | egrep '(1)|(8)'

Here is a little script that should generate an HTML list of section 1 and 8 commands

#!/usr/bin/env bash
apropos ' ' | awk ' /(1)|(8)/ {
match($0,/ - /)
cmd = substr($0,1,RSTART-1)
therest = substr($0,RSTART)
page = cmd
sub(/(.*/,"",page)
printf("%s%s
", page, cmd, therest)
}' >tmp.html

Apr 3, 2010 6:09 PM in response to red_menace

I read a poor review a while ago so was put off Bwana.

However I have just tried it and it does most things it claims to do. Pity 'man' does not work in Safari - I have to use 'man://'.

In common with other viewers it is not clear if the text width can be increased in the same way that it can with the standard terminal. Any thoughts on this?

It took over my computer for some time building its index but I assume this is a rare event. ManOpen was much faster at doing this.

Is there a way to invoke it by typing something simple in the terminal such as 'm ls' ? I have got ManOpen working in this way.

The HTML is better than most but not as clean as it could be. Putting 'width="50%"' on half the index TDs is totally unnecessary. The individual pages are much worse with much redundant use of 'span' tags. Nothing will validate without DOCTYPE statements. It is now storing its own copy of these bloated files on my disk!

Apr 3, 2010 6:25 PM in response to BobHarris

apropos ' ' | egrep '(1)|(8)' worked well first time and I agree with your excellent point. However I believe that it does miss quite a few terminal commands although most people may never need them.

Perhaps a quick copy paste of your longer script was too much to expect - it is in the early hours here - I will look at it tomorrow.

Apr 3, 2010 6:36 PM in response to Neville Hillyer

It looks like the application just extracts what is in the existing man file - the main body is in a <pre> statement. The first time it indexes, the HTML formatted commands are built and placed in the /Users/you/Library/Caches/Bwana/ folder, with an index page in the manindex-.html file - this is what I put into the browser tab.

It is mainly designed to be run in a browser, so if you don't want the bloated files you can just delete the cache folder - source code is available if you want to roll your own flavor.

Apr 3, 2010 8:35 PM in response to Neville Hillyer

However I believe that it does miss quite a few terminal commands although most people may never need them.

Section 2 are the "System Calls Manual" pages, useful to programmers. Think C, C++, Objective-C programming languages.

Section 3 are the "Library Functions Manual" pages, also useful to programmers.

Section 4 are the "Kernel Interfaces Manual" pages.

Section 5 are the "File Formats Manual" pages.

Section 6 are the "Games Manual" pages. OK, that might be interesting, if there were any interesting games listed 🙂

Section 7 are the "Miscellaneous Information Manual" pages.

Which leaves section 1 "General Commands Manual", and Section 8 "System Manager's Manual" pages.

Apr 4, 2010 3:54 AM in response to red_menace

As far as displayed width of text is concerned I suspect there is something more complex going on.

All the third party applications I have tried only display text at the default width whereas the default terminal can display text at whatever width you set its window. However this user set width is not picked up by third party applications which often allow you to set their window width but fail to alter the width of displayed text. I have also noticed that eg ManOpen will not work if /usr/bin/man is disabled. I have tried looking at various plist and config files but have not yet found a way to increase text width in anything other than the Terminal.

Can anybody shed any light on this?

I am new to groff but as far as I can tell it should replace source CRs within paragraphs with a space, ie not display each paragraph with <pre> (sorry about HTML terminology) as some of these third party applications apparently do.

Apr 4, 2010 5:15 AM in response to Neville Hillyer

I think there is something wrong with
apropos ' ' | egrep '(1)|(8)'


It produces a much shorter list than your earlier one and has very few items other than (1) and (8).

The (1) and (8) egrep (extended regular expression grep) basically says to find anything that contains the number 1 or the number 8. This caused it to select a lot of stuff from sections 2,3,4,5,6 and 7, which I really do not think of as Unix commands.

Of course if what you want is a list of all man pages, then the original post is very correct (apropos ' '). But then again, new Unix command line users never ask for a list of all the man pages, they always ask for a list of all the commands 🙂

Anyway, if you wish to continue along the lines of filtering the man page list for just commands, then using backslash in front of the open paren takes away its extended regular expression magic and eliminates selecting a lot of stuff from sections 2,3,4,5,6 and 7.

However, even my modified egrep is a little too aggressive, so the following should be a bit better (and I'll even throw in the games man pages)

apropos ' ' | egrep '(1|(6|(8'

I forgot that there are some man page entries that have a section tag along the lines of (1m) or (1ssl) or (1tcl). The above should include these section tags, and only has a false positive on 2 programming library function.

Again, this has just been an exercise in nit-picking, and egrep filtering experiments. Besides, a full list of all man pages is an interesting think in and of itself.

Message was edited by: BobHarris

List of terminal commands

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.