Saturday, July 5, 2008

Using shell in Ubuntu

Ubuntu provides a powerful and useful graphical interface. You can perform every type of task, such as finding and opening files and setting up network interfaces, using Ubuntu's graphics.However, Linux also provides a non-graphical and very powerful interface where you type commands at the keyboard instead of clicking a mouse. Microsoft Windows, as a matter of fact, is trying very hard to catch up with Linux and provide non-graphical commands.

Linux computers make extensive use of shells. Shells are programs that provide text-based user interfaces to the Linux operating system. When working in a shell, the user enters a command plus optional arguments, and the shell parses (separates the various parts of a command into usable parts) and then executes the command. Because shells are used to launch commands (programs), they're often referred to as the command line interface (CLI).

Shells provide both the platform to launch programs and a powerful programming environment. Any program that you interactively launch from a shell, you can also launch from a script — you create scripts to automate commands that you would normally manually type at the command line. Shells provide many of the functions you find in programming languages. You can put those functions into a file and you can execute that file like a program. This capability is so powerful that Microsoft has made a goal to make at least 90 percent of its GUI-based applications and utilities scriptable.

bash is the dominant shell in use today within the Linux world. Ubuntu uses bash as its default shell.

bash is a derivative of the Bourne shell and gets its acronym from that heritage — born again shell.

You open a shell using a Terminal Emulator in Ubuntu. A Terminal Emulator provides a window in which you type commands to a shell and receive output from the shell. Use the following steps to open a Terminal Emulator:
1. Click the Applications menu option at the top-left side of the screen.
2. Choose Accessories --> Terminal.
A window containing the bash shell opens.

The shell is configured to create a prompt of the following:
• Your username.
• The computer name: The username and computer name are separated by an at (@) character.
• The directory you're working from: The computer name and directory are separate by a colon (:) character. (Your home directory is represented by the tilda ( ) character.

The prompt is terminated with a dollar ($) character.
Anything you type at the prompt is interpreted as a command. Any results from executing the command are displayed on subsequent lines. For instance, type ls to get a directory listing, and you'll see any files that exist within your current working directory.

The bash shell and the MS-DOS window are similar in function. Both are interactive user interfaces from which you can execute commands. Here's the key technical difference:

• The bash shell (and Linux shells in general) only interprets your input. The shell feeds your input to the Linux kernel, which then executes the program and its arguments.
• MS-DOS contains the commands and does all the work itself.


Source of Information : Ubuntu Linux For Dummies

No comments: