Previous

Contents

Next

 

 

Shell Command Syntax

Using a shell is as simple as typing the command you want to use and pressing enter. There are a few rules, however, that might help if you are having trouble getting a command to work:

  Commands are case-sensitive, and are usually lowercase. Unlike Windows, you cannot mix case and still have a function work; you must type the command exactly as it is stored on the system.
  Frequently, the current directory isn’t included in the PATH environment variable that specifies all the directories of the commands that you can access by typing just the command’s name. (You’ll find out how to modify this in Lesson 16, “Modifying the User Environment.”) Because the current directory isn’t necessarily included, you might be in a directory that holds a program called parachute but you’ll find that you can’t run the program by typing parachute. In order to run the command, simply tell the system that the parachute command is in the same directory that you are in by preceding it with ./. Thus, parachute can be run by typing ./parachute from inside its directory.


Plain English:  
What’s with the . and /?  These characters represent the current directory (.) and the directory separator (/). Used together, ./ is essentially the path to the directory that you are currently in.


  There are special symbols, commands, and so on, that might leave your shell in a state that seems unusable. This generally means that you’ve started some sort of process that is expecting input from you. There are three control characters that might help you regain control of your commands. To type one of these control characters, hold down the control key while pressing the corresponding letter:
  Ctrl+d—Tells the computer that you are done sending input to a command. This is useful if you’ve accidentally started a program and can’t get out.
  Ctrl+c—The UNIX break character. This usually kills any program that is currently running, and then returns you to a command prompt.
  Ctrl+z—Suspends the current process. This suspends the process you were running and returns you to a command prompt. Logging out kills the suspended command.

Don’t be afraid to try the commands discussed in the book, and to explore the system to find more. You’ll be amazed at what can be done with a little bit of typing.

Summary

This lesson taught you a few very important skills that you need to begin using your UNIX computer effectively. Although most of the concepts introduced are relatively simple, they are important in understanding how and why UNIX operates the way it does.

  Login—Logging in to UNIX allows the system to identify you as a user and apply the appropriate ownership to files you create and modify. Each user has his or her own environment and can run programs simultaneously with other users.
  Logout—Logging out of the computer closes open files and ends processes that are owned by the current user. Always log out of the system when you are done using it.
  The Command Line—The UNIX command line enables you to create complex functions by stringing together a variety of built-in commands. What requires specialized software on other systems can usually be accomplished using built-in UNIX utilities.
  Shells—There are many different types of shells that you can use. Depending on your needs as a programmer and user, you need to evaluate the shell features you find necessary, and choose appropriately.
  Using the Command Line—Commands can be typed directly into a shell, as you might expect. Keep in mind that commands are usually lowercase, and you might need to specify a path to a command if it is not included in your PATH environment variable.

 

Previous

Contents

Next

 


 


 

Hosted by www.Geocities.ws

1