The Terminal represents your gateway to the UNIX back-end of Mac OS X. It is normally located in the Utilities folder, inside the Applications folder. WARNING: chmod, mv, and rm can do bad things to your system if misused, including making Mac OS X no longer boot. Make sure you know what you're doing BEFORE you do it, since there isn't an undo.
First, a guide to the most frequently needed commands:
cd: change directory
This command takes one argument, the directory to change to. You can also drag the folder name from the Finder to the Terminal window, which makes changing the working directory a lot simpler.
pwd: print working directory
This command takes no arguments. It simply displays the current working directory. Useful for finding out exactly where you are.
mv: move
This command takes 2 arguments: The file to be moved, and the new name for this file. Note that this command is also used to rename files.
man: manual
This command takes one argument: The name of the command to get manual information about. Note that the manual page viewer is operated with the keyboard, and not the mouse. Use the spacebar to advance one page of text at a time.
rm: remove
This command takes a variable number of arguments: A list of files/directories to remove. Note that there is no Undo if you delete something this way.
chmod: change mode
This command is a bit more complex than the others, but it's real handy for changing permissions. I highly recommend reading its manual page to learn how it works.
ls: list directory contents
This command can either be used with no arguments, to list the contents of the current directory, or with one argument, to list the contents of a directory other than the current one. It supports some options, such as -a (show hidden files) and -l (long list format). These two options can be combined, as in: ls -al
Navigating the UNIX folder structure
Mac OS X uses a UNIX-like directory scheme for most of its inner workings. If you've used Linux before, you'll learn the Mac way quickly. The bin folder is where most normal commands go. The sbin folder contains commands that generally require elevated permissions to use. There are also other folders, like etc (for systemwide settings), var (for various things), and tmp (where temporary files live). If you use the GUI, you never need to worry about these things - they work behind the scenes. All these folders live inside /, the root of the file system (usually corresponding to Macintosh HD in the GUI).
Other useful commands
zip: compress files
This one's real handy. Ever wanted to make an archive of a folder, but didn't want those ugly __MACOSX folders showing up in your archives? This tool automatically strips those. Here's a simple guide to its use:
zip -r filename.zip * - compress everything in the current working folder, including subfolders
zip -d filename.zip *.DS_Store - remove those unwanted .DS_Store files from your archives
First, a guide to the most frequently needed commands:
cd: change directory
This command takes one argument, the directory to change to. You can also drag the folder name from the Finder to the Terminal window, which makes changing the working directory a lot simpler.
pwd: print working directory
This command takes no arguments. It simply displays the current working directory. Useful for finding out exactly where you are.
mv: move
This command takes 2 arguments: The file to be moved, and the new name for this file. Note that this command is also used to rename files.
man: manual
This command takes one argument: The name of the command to get manual information about. Note that the manual page viewer is operated with the keyboard, and not the mouse. Use the spacebar to advance one page of text at a time.
rm: remove
This command takes a variable number of arguments: A list of files/directories to remove. Note that there is no Undo if you delete something this way.
chmod: change mode
This command is a bit more complex than the others, but it's real handy for changing permissions. I highly recommend reading its manual page to learn how it works.
ls: list directory contents
This command can either be used with no arguments, to list the contents of the current directory, or with one argument, to list the contents of a directory other than the current one. It supports some options, such as -a (show hidden files) and -l (long list format). These two options can be combined, as in: ls -al
Navigating the UNIX folder structure
Mac OS X uses a UNIX-like directory scheme for most of its inner workings. If you've used Linux before, you'll learn the Mac way quickly. The bin folder is where most normal commands go. The sbin folder contains commands that generally require elevated permissions to use. There are also other folders, like etc (for systemwide settings), var (for various things), and tmp (where temporary files live). If you use the GUI, you never need to worry about these things - they work behind the scenes. All these folders live inside /, the root of the file system (usually corresponding to Macintosh HD in the GUI).
Other useful commands
zip: compress files
This one's real handy. Ever wanted to make an archive of a folder, but didn't want those ugly __MACOSX folders showing up in your archives? This tool automatically strips those. Here's a simple guide to its use:
zip -r filename.zip * - compress everything in the current working folder, including subfolders
zip -d filename.zip *.DS_Store - remove those unwanted .DS_Store files from your archives