In the command line interface, you enter commands to tell the operating system which task you want to perform. When commands are entered, they are read by a command interpreter (also known as a shell) and then processed. You can use three different shells: Korn (also known as POSIX), Bourne, and C.
The login shell refers to the shell that is loaded when you log in to the computer system. Initially, the Korn shell is set up as the login shell.
Although some commands can be entered by simply typing one word, other commands use flags and parameters. Each command has a syntax that designates the required and optional flags, files, and parameters.
$ CommandName $ ProgramName
Some general rules about commands are:
Spaces between commands, flags, and file names are important.
Flags modify the way the command runs. Flags are often single letters preceded by a - (minus sign) and are set off by spaces or tabs.
Two commands can be entered on the same line by separating the commands with a ; (semicolon). For example:
$ CommandOne;CommandTwo
The operating system runs the commands sequentially.
Commands are case-sensitive. The shell distinguishes between uppercase and lowercase letters. To the shell, print is not the same as PRINT or Print.
A very long command can be entered on more than one line by using the \ (backslash) character at the end of the line and pressing Enter. A backslash signifies line continuation to the shell. The > (continuation prompt) appears on the next line to indicate that the system is waiting for more input. The following example is one command that spans two lines.
$ ls Mail info temp \ > diary
When entering commands, you are likely to encounter one of the following problems: a misspelled command, an incomplete command, or a case-sensitive command.
When you enter a misspelled command, the shell may return an error message. For example, if you entered whiami instead of whoami, the system displays the following on your screen:
$ whiami /bin/ksh: whiami: not found. $
You might get an error message even if it appears that you typed the command correctly. Invisible control characters typed in by mistake usually cause this. Just retype the command when the prompt appears.
If an incomplete command is entered, the system waits for the command to be completed and may appear to be frozen (not doing anything). For example, the cat command is always used with a file name. If the command you had intended to enter was cat testfile, but instead you entered cat, the screen appears as follows:
$ cat _
If you enter the file name now, the screen appears as in the following example. The file name is repeated (echoed), but the system is still not doing anything.
$ cat testfile testfile _
To restore operation, press Ctrl-C. This causes the system prompt to return. Your screen appears as in the following example.
$ cat testfile testfile ^C$
If you enter a command using the wrong case, the shell may display an error message. For example, if you entered Ls instead of ls the system displays the following on your screen:
$ Ls /bin/ksh: Ls: not found. $