Running Commands from the Shell
computer software
Running Commands from the Shell Running Commands from the Shell
Running Commands from the Shell   Home | Site Map | About Us | Products | Services | News | Contact Us | Links Running Commands from the Shell
Running Commands from the Shell Running Commands from the Shell

Copyright © 2009

Linux® Bible


In most Linux systems, the
$
and
#
prompts are preceded by your username, system name, and
current directory name. For example, a login prompt for the user named jake on a computer
named pine with
/tmp
as the current directory would appear as:
[jake@pine tmp]$
You can change the prompt to display any characters you like -- you can use the current directory,
the date, the local computer name, or any string of characters as your prompt, for example. To
configure your prompt, see the "Setting Your Prompt" section later in this chapter.
Although a tremendous number of features are available with the shell, it's easy to begin by just
typing a few commands. Try some of the commands shown in the remainder of this section to
become familiar with your current shell environment.
In the examples that follow, the dollar (
$)
and pound (
#)
symbols indicate a prompt. While a
$
indicates that the command can be run by any user, a
#
typically means you should run the com-
mand as the root user -- many administrative tools require root permission to be able to run them.
The prompt is followed by the command that you type (and then you press Enter or Return, depend-
ing on your keyboard). The lines that follow show the output resulting from the command.
Using a Terminal Window
With the desktop GUI running, you can open a terminal emulator program (sometimes referred
to as a Terminal window) to start a shell. Most Linux distributions make it easy for you to get to
a shell from the GUI. Here are two common ways to launch a Terminal window from a Linux
desktop:
Right-click the desktop. In the context menu that appears, look for Shells, New
Terminal, Terminal Window, Xterm, or some similar item and select it. In Fedora, right-
click on the desktop and click Open Terminal.
Click on the panel menu. Many Linux desktops include a panel at the bottom of the
screen from which you can launch applications. For example, in systems that use the
GNOME desktop, you can select Applications Accessories Terminal to open a
Terminal window. For Mandriva, select System Terminals.
In all cases, you should just be able to type a command as you would from a shell with no GUI.
Different terminal emulators are available with Linux. One of the following is likely to be the
default used with your Linux system:
xterm -- A common terminal emulator for the X Window System. (In fact, I've never
seen an X Window System for a major Linux distribution that didn't include xterm.)
Although it doesn't provide menus or many special features, it is available with most
Linux distributions that support a GUI.
37
Running Commands from the Shell
2