To execute a command in the shell, enter the complete pathname of the tool’s executable file, followed by arguments, then press Return.
If a command is located in one of the shell’s known folders, you can omit path information and enter the command name. The list of known folders is stored in the shell’s PATH environment variable and includes the folders containing most command-line tools.
For example, to run the ls
command in the current user’s home folder, enter the following at the command line and press Return:
host:~ mariah$ ls
The shell looks through the list of folders in the PATH variable until it finds a program named ls; in this case, it finds ls
in /bin, and runs /bin/ls.
To run a command in the current user’s home folder, precede it with the folder specifier. For example, to run MyCommandLineProg
, use the following:
host:~ mariah$ ~/MyCommandLineProg
To open an application, use the open command:
open -a MyProg.app
When entering commands, if you get the message command not found
, check your spelling. Here’s an example:
server:/ mariah$ opne -a TextEdit.app -bash: opne: command not found