Terminal Icon

Running shell scripts in Terminal

If you have a shell script you use often, you can open it and run it in Terminal.

To run a shell script in Terminal:

  1. Choose Shell > New Command.

  2. Enter the path to the script in the Command field.

  3. If you want to view the output of the script in a Terminal window, select “Run command inside a shell.”

    A new Terminal window will open.

  4. Click Run.

You can also save your script as plain text (the .command filename extension is not required). Use the chmod command in Terminal to make the file executable. When you double-click the file in the Finder, Terminal opens and runs your script.

Although the .command files are named similarly to the .com files found in DOS and Windows, they are not related.


Related Topics

UNIX