Terminal Icon

Using command files with Terminal

If you have a command-line script that you use often, you can open and run it in Terminal using the Finder.

  1. Choose File > New Command.
  2. Type (or copy and paste) the command or script in the run command dialog.
  3. If you want to view the output of the command, select "Run command inside a shell." A new Terminal window will open.
  4. Click Run.

If you're comfortable working with command-line files, you can also save your script as plain text (the .command filename extension is not required). Then use chmod in Terminal to make the file executable. When you double-click the file in the Finder, Terminal opens and runs your script.

While these files are similarly named, they are unrelated to the .com files found in DOS and Windows.

See also

UNIX