How to Use Terminal to Work in UNIX on Your Mac - dummies

How to Use Terminal to Work in UNIX on Your Mac

You can use the Mac application Terminal to work in UNIX. To work in the Terminal window, as in Windows, you can use an asterisk (*) as a wildcard in a filename in most commands. Also like Windows, bash can complete a partially typed command or filename, if it can figure it out, when you press Tab.

You can copy text from the Terminal window, but you can’t cut or insert text. If you can paste text into the terminal window, it’s appended to whatever you’ve already typed after the prompt.

If you drag an OS X file or folder icon to the Terminal window, the pathname of the file or folder is inserted where you are typing.

You’ll also notice differences as well as similarities between the Windows command line and UNIX. Many of these differences go back to the early days of DOS and were deliberately introduced to avoid legal problems from AT&T, the original developer of UNIX.

  • Pathnames: A pathname specifies where a file is located, starting at the top-level or root directory. Windows separates names with a backslash (), while UNIX, like the Internet, uses a forward slash (/). Versions of Mac OS 9 and earlier used a colon (:).

  • Hidden files: Filenames that start with a period (.) are normally hidden and are often used to store the settings for various programs. Type ls –a to see them.

  • Home directory: UNIX uses the tilde character (~) as an abbreviation for the home directory. You sometimes see this on the Internet as well.

  • Switches: Like Windows commands, UNIX commands have switches that follow the command name to modify its action. In Windows, switches are indicated by a forward slash. In UNIX, switches are usually indicated by a hyphen (-).

  • More about commands: Windows uses help. UNIX uses man, which stands for manual. In UNIX, type the following: man command-name

OS X comes with thousands of man pages mostly copied from BSD UNIX. UNIX fans love man pages because they don’t waste verbiage on cute analogies and historical asides, and they tend to be authoritative. Beginners often find them maddeningly terse.