Next: B.3.5 A Brief List Up: B.3 Entering Text Commands. Previous: B.3.3 Graphical Terminals Contents Index

## B.3.4 Introduction To Terminal Commands

When a terminal starts it will show you some sort of prompt that says it is ready to accept a command. This prompt will most likely show you who you are and where you are. On this PC that prompt looks like [root@surfer ray]# This prompt says that I am root and I am at a PC named surfer and I am in the directory named ray. If you are curious who you really are you can issue the command

  whoami<enter>

which gets me the answer ``root.'' Issuing the command

  pwd<enter>

is equivalent to asking the question where am I? This command gets me the answer /home/ray.

This is in essence how the entire text mode of Linux works works. At a prompt, you enter a command and press the <enter> key.

The command may have arguments that go along with it. Let me illustrate with the Linux equivalent of the ms-dos dir command. That command is ls (lower case LS). The response that I get to this command is a window full of file names. They may arranged in multiple columns, but that depends upon the size of the terminal window and the length of the file names. A brief list follows.

  bash-2.05$ ls

  158533.pdf

  189458.pdf

  IntPS.jpg

The ls command will take arguments so if I issue the command ls -l I will get a different listing that the first one.

  bash-2.05$ ls -l

  total 34284

  -rw-r-r- 1 ray ray 299330 Apr 14 17:53 158533.pdf

  -rw-r-r- 1 ray ray 42089 Apr 14 17:53 189458.pdf

  -rw-r-r- 1 ray ray 300768 May 23 17:13 IntPS.jpg

There are several ways that you can use to find out about the arguments that a command will take. In a terminal window you can issue the command info or man followed by the command that you want to study. Most graphical environments have help systems that are easier to use than these terminal commands. If I issue the

  info ls

command with the ls argument as above, Linux runs a program called info that returns what it can find about the command ls. Among all of the info stylized report, I can find out that

- `ls': List directory contents
- The `ls' program lists information about files (of any type, including directories).
- Options and file arguments can be intermixed arbitrarily, as usual.
- by default `ls' lists the contents of directories, not recursively,
- omitts files with names beginning with `.'.
- By default, the output is sorted alphabetically.

The fact that you entered a single word, info, and the terminal executed a program named info is the significant point here. There are thousands of commands. Any file marked with executable permissions is an acceptable command to the terminal. If this file resides in a directory that is not included in the normal Linux path, you will have to preceed the filename with a ./ so that Linux assumes that you want to look for this command in the current directory.

There are many different ``command shells'' available to users of Linux. Right now I can almost hear you gasp - ``I don't really want to know this.'' Most all of the shells will execute a command like ls and will start a binary file for you. Which shell you are running becomes important if the file that you want to run is a script. Under dos we commonly wrote script files and gave them a .bat extension.

These script files become important for EMC users because the .run files that start the EMC are script files. Fortunately, writers of good script files, include a line at the top of their script file that specifies the shell that the file is written to run with. Any terminal will see such a line and switch itself to the shell specified.

Next: B.3.5 A Brief List Up: B.3 Entering Text Commands. Previous: B.3.3 Graphical Terminals Contents Index