Summary
To learn more about a command in your terminal on macOS, enter the following command:
man command-name
If you’re using Git Bash on Windows, use the following command instead:
command-name --help
Details
As an example, if you wanted to learn more about the ls
command, you would enter the following command in your terminal on macOS:
man ls
To learn more about ls
in Git Bash, use the following command:
ls --help
This command will open what’s called the man page (short for manual page), which will look something like this:
LS(1) BSD General Commands Manual LS(1)
NAME
ls -- list directory contents
SYNOPSIS
ls [-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1%] [file ...]
DESCRIPTION
For each operand that names a file of a type other than directory, ls displays its name as well as any
requested, associated information. For each operand that names a file of type directory, ls displays the
names of files contained within that directory, as well as any requested, associated information.
To scroll through the man page, use the Up and Down arrow keys.
To quit the man page, press the Q key on your keyboard.
Please note that not all commands have a man page associated with them.
Exercises
Try the following command in your project folder (it will actually work in any folder):
man ls
References
Command Line Primer on the Apple Developer Archive (see the section called Learning About Other Commands at the bottom of the page)