What Is a Command?

A command is a file containing a set of instructions that UNIX can run or execute. In operating systems such as Mac OS or Windows, commands are executed by clicking their icons. In UNIX, a command is executed by typing in its name and pressing Enter or Return. For example, in order to execute the date command, use the following:

$ date [ENTER]
Wed Dec  9 08:49:13 PST 1998
$

The purpose of the date command is to display the current day, date, time, and year. Notice that after the command finishes executing, the character $ is displayed. This character is the prompt. When a prompt is present, the name of a command can be given for execution. The shell reads the command name and tries to execute it. While the command executes, ...

Get Sams Teach Yourself Shell Programming in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.