Jumat, 08 Mei 2009

Traditionally, most new users have always been reluctant to experiment with the command line interface, (commonly referred to as the terminal) yet it has always been one of the most important parts of learning Linux. Once you understand the terminal, Linux will finally open up to you. The terminal is easily the most powerful part of a Linux system; it is your way of being able to work directly with the operating system without any barriers or hindrance.

This guide will cover basic terminal usage in addition to ways to enhance basic commands. For the sake of simplicity, we will only address the underlying concepts of shell scripting instead of covering it in detail. We saved this part of our guide for last because it is typically the most difficult to grasp. However, the terminal is fairly easy to understand when broken down into simple concepts.

Overview of the Linux Terminal

Linux has many different shells that you can use for your terminal. One of the most common shells is called Bash, an abbreviation for “Bourne-Again Shell”. (a successor to the original Bourne Shell) Other popular shells include the original Bourne Shell, (sh) the Korn Shell, (ksh) and the C shell. (csh) If you are running a window manager, you would interact with a shell program through a terminal emulator like Xterm, GNOME Terminal, Konsole, or something similar. However, if you are not running a window manager or any other GUI, the terminal is your only way of interacting with the system. Generally, the terminal is a fail-safe repair system if Xorg (the GUI system) were to malfunction.

The Bash Shell

This article will focus primarily on Bash, but is applicable to other shells as well. Each shell program has its own strengths and weaknesses and is different from the others, but you are not likely to experience this very much unless you get into complicated shell scripting and programming. In the case of simple commands, the various shells operate in much the same way.

Gnome and Xterm

Basic Terminal Concepts

Although Bash and other terminals vaguely resemble DOS, there are fundamental differences. While DOS is a full (albeit simple) operating system with the core functionality built in, Bash is simply a command shell that provides an interface to the operating system it runs on. The first thing you must understand is that Bash has very little built-in functionality of its own. Every time you run a command in Bash, (no matter what it is) you are actually invoking another program as a separate process. Bash and other similar shells use a set of core utilities for basic file operations. (Some of the most important of these may be found at the end of this article) Text-based utilities like file copying/deletion/renaming, process management, and disk usage are all handled externally; although they appear to be part of Bash, that is not the case.

Since the shell assumes that all programs are either in /bin or /usr/bin, Bash does not need a full pathname or require you to navigate to a specific directory to start a program. To run a program, simply type the program name at the command prompt. (e.g “vim” or “firefox”) In this article, we will refer to simple commands like these as “base commands.”

The tilde (~) symbol is used as a reference to your home directory. In all instances there you would normally have to provide the full pathname of your home directory, the ~ symbol may be used instead as a matter of convenience. For instance, ~/sub_folder is the same as /home//sub_folder. To navigate to your home folder from anywhere in the filesystem, you need only type “cd ~”.

Like the rest of Linux, a shell has two levels of privilege: regular users and super users. At the command prompt, Bash will list the name of the current user in addition to the name of the machine the terminal is running on. The user listed first and the machine listed second, with an @ symbol separating them. (e.g. frodo@shire or root@aux) Bash will also list the current directory as well. Many other shells are far less verbose and list only “$” for all regular users and “#” for the root account.

Each shell can run only one command at a time. However, you can run as many shell processes as you wish at the same time under a GUI with a terminal emulator. Many terminal emulators have a tab system that lets you easily switch back and forth between any shells that you have open. Without a GUI, you can run up to seven terminals at a time on most distros; these terminal processes are assigned a prefix of “tty” (Teletype) and a number. tty1-tty6 are generally available at any given time, whereas tty7 is normally used to run the GUI system and is therefore not available for other use. To switch to a different tty, press CTRL+ALT+Fx, where x is the number of the tty you would like to use. For example, to switch to tty3, press CTRL+ALT+F3.

Each program started from a terminal becomes bound to that terminal as a child process; if you close a terminal, any child processes managed by that terminal are closed as well. If you want to keep a process running no matter what happens to its parent terminal, you must precede the command with “nohup” (short for “no hangup”) when you launch it. Instead of displaying output in the terminal window as is the norm, programs launched with nohup have all output written to a file called nohup.out.

To terminate a running program before it is supposed to finish, press CTRL+C.

Switches

Many programs can perform multiple functions, so additional parameters called switches are used in addition to the base command to provide access to this functionality. Switches are preceded by a dash, placed after the base command, and use letters or numbers as references to certain functions. Since you can invoke multiple switches at once, (e.g. tar -czvf ) it is possible to fine-tune the actions of a program in very specific ways that the base command all by itself would not allow. Switches can be grouped together as shown in the previous example.

You should remember that switches are case-sensitive and can do different things depending on whether they are uppercase or lowercase; for example, “-R” is not the same thing as “-r”. If you use switches that happen to conflict with each other or are invalid, the program will display an error message that explains the problem. To see all possible switches for a program, you should refer to its manual page. (run “man ”) The manual page will also provide detailed usage parameters for a program in addition to examples and background information. Almost every program has a manual page associated with it, often in addition to more conventional documentation.

Wildcards

Bash and other shells support the use of wildcards, which are used to substitute unknown or non-designated characters in commands. The wildcard symbol is the asterisk. (*) Wildcards differ from variables, which are used to bind specific values in shell scripts and more advanced Bash applications.

Wildcards are frequently used with the list command. (ls). Using wildcards, you can force ls to show only certain types of files in its output instead of everything. For example, “ls *.png *.html” will display all PNG and HTML files in a directory.

Wildcards may also be used to show all files in a directory that start with a certain letter; “ls a*” will display any file that begins with the letter a. It is also possible to apply a wildcard to a set of characters. For example, “ls [abc]*” will display any file in a directory that begins with a, b, or c.

Health is always on guard especially a woman, must maintain the vagina so that its pitch hindar from white to an other and another please click below Benjolan on the skin, known as a keloid may be about our skin, especially when there are injuries, whether infected sketch knife, burn, boil or pimple used. Keloid attached in the skin often seen in the eyes of frustrating. Keloid can cause aesthetic, especially Missing keloid, Skin is Beautiful
thank you have come on my blog, click here to return to the face or you can also click on the frofil again if you want to read more about issues Google Adsense’s online shopping blog and Women’s Health
Thank you for visiting my blogg click here to return to face Layout Manager For DialogBars