Why Use a Shell Prompt?

Graphical environments for Linux have come a long way in the past few years. You can be perfectly productive in the X Window System and only have to open a shell prompt to complete a few tasks. However, many Red Hat Linux functions can be completed faster from the shell prompt than from a GUI. In less time than it might take you to open a file manager, locate a directory, and then create, delete, or modify files from a GUI, you could have finished your work with just a few commands at a shell prompt.

Figure 8-1. A Shell Prompt

A shell prompt looks similar to other command-line interfaces you might be familiar with, such as MS-DOS. When you enter commands at a shell prompt, the shell interprets these commands and then tells the Linux operating system (OS) what to do. Experienced users can write shell scripts to expand their capabilities even further.

The following sections explain how to navigate, manipulate files, perform simple administration tasks, and other shell prompt basics.

Determining Your Current Directory with pwd

Once you start looking through directories, it is easy to get lost or forget the name of your current directory. By default, the bash shell shows only your current directory, not the entire path.

Figure 8-2. The pwd Command Shows You Where You Are

To determine the exact location of your current directory within the file system, go to a shell prompt, type the command pwd, and press Enter.

You should see something like:


This tells you that you are in the user sam's directory, which is located in the /home directory.

The pwd commandstands for print working directory. When you enter the pwd command, you’re basically asking Linux to display your current location within the file system. Linux responds by printing the name of the current directory at the shell prompt, also known as the standard output.

You will find that using pwd is very helpful as you learn to navigate Red Hat Linux.

The Red Hat Documentation Team - Official Red Hat Linux User's Guide
The Red Hat Documentation Team - Official Red Hat Linux User's Guide
Year: 2002
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net