A notable context in which commands are prevalent is the
operating system shell. Commonly, the shell dispatches a command to a program that has a file name matching the first parameter. In a
Unix shell (such as
bash and many related variants), the match must be exact including case. The following bash command changes the
working directory to
/home/pete by invoking the program
cd: cd /home/pete The following bash command writes "Hello World" via program
echo to
standard output typically the
terminal. Quotes around the two words indicate that the phrase is treated as a single parameter. echo "Hello World" The following demonstrates how the default behavior of a command is modified with a switch. The switch causes the command to treat characters prefixed with a backslash as the associated control character. In this case results in a tab character. echo -e "Hello\tWorld" In shells such as
command prompt,
DOS, and
OS/2 some commands are
built-in: not implemented as a separate program. But, if a command is not built-in, then the shell dispatches to a program that has an executable extension (such as
.exe) and base name matching the first parameter ignoring case. The following command prompt command displays the content of file
readme.txt via the built-in command
type. type readme.txt The following command prompt command lists the contents of the current directory via built-in command
dir. The switch
/Q modifies default behavior to include owner information. dir /Q == See also ==