easily done by typing in commands. For example, you can tell the operating system to list certain files in a folder or run a given program in a particular way.
Linux, Windows, and Mac OS X all have a command-line interface that allows you to do this. In Linux and Mac OS X, you use a Terminal program to show you the com- mand-line interface,
which is called the shell. In Windows, you use the Command
Prompt Window program to show you the Command Prompt,
sometimes called theDOS prompt.
In this section, we’ll describe how each command-line interface works you can skip the descriptions for the operating systems you don’t use.
The Linux and Mac OS X ShellTo access the shell under Linux,
open a terminal program, such as konsole
, rxvt
, or xterm these are often listed in the main menu under the System or System Tools group,
and maybe simply labeled Terminal. To access the shell under Mac OS X, open a terminal window by double-clicking on the Terminal icon in the Utilities folder under the Applications group.
Under Linux, you’ll see a prompt similar to this one:
[adam@eden
while under Mac OS X, you’ll see something like this:
eden:
adam$
This
shell prompt indicates what user account you’re logged in under, what computer you’re logged into, and what directory you’re working from. You’ll generally be first logged in as an ordinary user (we’ve shown the user adam hereon the computer
(eden
), and working from your home directory. The tilde (
) character is a shortcut symbol to a user’s home directory
on any Unix-like system, including Linux and Mac
OS X for example, a user’s home directory could be
/home/adam
, but
you can refer to it as adam, or, if you’re logged in as adam
, simply as
. The sample prompt shows that the user adam is logged into the computer eden and working from his home directory.
To keep things simple, we’ll just show a dollar sign to
indicate the Linux or Mac OS Xshell prompt, as below:
$
From the shell, you can run many useful commands we’ll see some as we progress through this book. Two standard commands that are important to know for this book are:
cd
Changes your working folder or directory on disk. For example, you can change to the
/tmp
directory by typing cd /tmpShare with your friends: