CHAPTER 13 INTRODUCING (Web hosting india) THE BASH SHELL Don t

CHAPTER 13 INTRODUCING THE BASH SHELL Don t worry too much about the details right now. The important thing to know is that whenever you type a program name, the shell looks in each of the listed directories in sequence. In other words, when you type ls, the shell will look in each of the directories stored in the PATH variable, starting with the first in the list, to see if the ls program can be found. The first instance it finds is the one it will run. (The ls command gives you a directory listing, as described in the Listing Files section later in this chapter.) But what if you want to run a program that is not contained in a directory listed in your PATH? In this case, you must tell the shell exactly where the program is. Here s an example: /home/keir/myprogram This will run a program called myprogram in the /home/keir directory. It will do this regardless of the directory you re currently browsing, and regardless of whether there is anything else on your system called myprogram. If you re already in the directory where the program in question is located, you can type the following: ./myprogram So, just enter a dot and a forward slash, followed by the program name. Getting Help Each command usually has help built in, which you can query (a little like typing /? after a command when using DOS). This will explain what the command does and how it should be used. In most cases, you ll see an example of the command in use, along with the range of command options that can be used with it. For example, you can get some instant help on the ifconfig command by typing this: ifconfig –help You ll see the help screen shown in Figure 13-2. The –helpoption is fairly universal, and most programs will respond to it, although sometimes you might need to use a single dash. Just type the command along with –help to see what happens. You ll be told if you re doing anything wrong. In addition, most commands have manuals that you can read to gain a fairly complete understanding of how they work. Virtually every Ubuntu setup has a set of these man pages, which can be accessed by typing this: man However, man pages are often technical and designed for experienced Ubuntu users who understand the terminology.

Leave a Reply