Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Frequently Used Commands

Shell programming involves a mixture of built-in shell commands and standard programs that run in all shells. While most shells offer the same basic set of commands, there are often variations in the syntax and behavior of those commands. In addition to the shell commands, Mac OS X also provides a set of standard programs that run in all shells.

Table A-4 lists some of the more commonly used commands and programs. Because most of the items in this table are not built-in shell commands, you can use them from any shell. For syntax and usage information for each command, see the corresponding man page. For a more in-depth list of commands and their accompanying documentation, see Mac OS X Man Pages.

Table A-4  Frequently used commands and programs

Command

Meaning

Description

cat

Catenate

Catenates the specified list of files to stdout.

cd

Change Directory

A common shell command used to navigate the directory hierarchy.

cp

Copy

Copies files and directories (using the -r option) from one location to another.

date

Date

Displays the current date and time using the standard format. You can display this information in other formats by invoking the command with specific arguments.

echo

Echo to Output

Writes its arguments to stdout. This command is most often used in shell scripts to print status information to the user.

less

Scroll Through Text

Used to scroll through the contents of a file or the results of another shell command. This command allows forward and backward navigation through the text.

ls

List

Displays the contents of the current directory. Specify the -a argument to list all directory contents (including hidden files and directories). Use the -l argument to display detailed information for each entry.

mkdir

Make Directory

Creates a new directory.

more

Scroll Through Text

Similar to the less command but more restrictive. Allows forward scrolling through the contents of a file or the results of another shell command.

mv

Move

Moves files and directories from one place to another. You also use this command to rename files and directories.

open

Open an application or file.

You can use this command to launch applications from Terminal and optionally open files in that application.

pwd

Print Working Directory

Displays the full path of the current directory.

rm

Remove

Deletes the specified file or files. You can use pattern matching characters (such as the asterisk) to match more than one file. You can also remove directories with this command, although use of rmdir is preferred.

rmdir

Remove Directory

Deletes a directory. The directory must be empty before you delete it.

Ctrl-C

Abort

Sends an abort signal to the current command. In most cases this causes the command to terminate, although commands may install signal handlers to trap this command and respond differently.



< Previous PageNext Page > Hide TOC


Last updated: 2007-10-31




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice