-->

Basic Bash Shell Commands On Linux

The default shell used in many Linux distributions is the GNU bash shell. This article will describes the basic features available in the bash shell, such as the bash manual, tab auto-completion and how to display a file’s contents. You will walk through how to work with Linux files and directories using the basic commands provided by the bash shell. If you’re already comfortable with the basics in the Linux environment. For the next article, you will see more advanced commands.

Basic Bash Shell Commands On Linux
Basic Bash Shell Commands On Linux


Starting the Shell

The GNU bash shell is a program that provides interactive access to the Linux system. It runs as a regular program and is normally started whenever a user logs in to a terminal. The shell that the system starts depends on your user ID configuration.

The /etc/passwd file contains a list of all the system user accounts, along with some basic configuration information about each user. Here’s a sample entry from a /etc/passwd file:

christine:x:501:501:Christine Bresnahan:/home/christine:/bin/bash

Each entry has seven data fields, with fields separated by colons. The system uses the data in these fields to assign specific features for the user. Most of these entries are discussed in more detail in next article (7). For now, just pay attention to the last field, which specifies the user’s shell program.

Note
Though the focus is on the GNU bash shell, additional shells are reviewed in this
book. Chapter 23 covers working with alternative shells, such as dash and tcsh.
In the earlier /etc/passwd sample entry, the user christine has /bin/bash set as her
default shell program. This means when christine logs into the Linux system, the bash
shell program is automatically started.

Although the bash shell program is automatically started at login, whether a shell
command line interface (CLI) is presented depends on which login method is used. If a
virtual console terminal is used to log in, the CLI prompt is automatically presented, and
you can begin to type shell commands. However, if you log into the Linux system via a
graphical desktop environment, you need to start a graphical terminal emulator to access
the shell CLI prompt.

Using the Shell Prompt

After you start a terminal emulation package or log in to a Linux virtual console, you get
access to the shell CLI prompt. The prompt is your gateway to the shell. This is the place
where you enter shell commands.

The default prompt symbol for the bash shell is the dollar sign ($). This symbol indicates
that the shell is waiting for you to enter text. Different Linux distributions use different
formats for the prompt. On this Ubuntu Linux system, the shell prompt looks like this:

christine@server01:∼$

On the CentOS Linux system, it looks like this:

[christine@server01 ∼]$

Besides acting as your access point to the shell, the prompt can provide additional helpful
information. In the two preceding examples, the current user ID name, christine, is
shown in the prompt. Also, the name of the system is shown, server01. You learn later in
this chapter about additional items shown in the prompt.

Tip
If you are new to the CLI, keep in mind that, after you type in a shell command at the
prompt, you need to press the Enter key for the shell to act upon your command.
The shell prompt is not static. It can be changed to suit your needs. Chapter 6, “Using
Linux Environment Variables,” covers modifying your shell CLI prompt configuration.

Think of the shell CLI prompt as a helpmate, assisting you with your Linux system, giving
you helpful insights, and letting you know when the shell is ready for new commands.
Another helpful item in the shell is the bash Manual.


0 Response to "Basic Bash Shell Commands On Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel