Linux Beginner's Shell primer

Source: Internet
Author: User
Tags command line linux

Objective

Using the Shell

The basic shell commands and mechanisms are described and explained below.

First: Super Tools/terminals,xterms and Shells

One, Super tool

You've probably heard the argument that the command line (the Mommand lines) is already obsolete, the thing is mysterious, and so on. Some people even feel that the operating system should not have these commands to be good.

The fact is, you can use Linux without knowing any shell. After you start the system, you can go directly to X window, and finally to the X window down the machine.

I firmly believe that using Linux instead of the shell is like driving a car with just the head file (first gear). Of course, at first it looks straightforward and simple, and in most cases it works. But the speed is slow, and can not really experience the fun of driving.

Yes, the command line is interesting. As with a large collection of building blocks, you can complete many unexpected initiatives, some extremely complex work, only a few lines of command can be solved. This is because, in Unix, the shell is not a simple command interpreter (typically with DOS in Windows), but rather a full-featured programming environment.

This does not mean that the shell is very easy to learn, you know, strewn, it still takes a bit of effort. ;-) But please believe me, it's definitely worth it. In a very short time, you can be touted as a Unix wizard by a large layman. *grin*

Second, in order to illustrate the shell, here need some background knowledge.

1, terminals, xterms and Shells

Dating back to the time of the birth of Unix, there was no "personal computer" that was now popular. A machine called a computer, or a magnetic memory (the term ' core ' to denote system memory). DEC Company (now COMPAQ) launched the PDP-11, small (known as the mini) and the price of the bottom, in the university caused a huge response, many schools until then to buy a computer (PDP-11 cheap, only 10000$).

The operating system of these machines is written in assembly language and machine language, so it is efficient to run, but cannot be ported (unportable). Each computer company gives its own machines a unique operating system, which is then sold.

This clumsy approach quickly became known, and began to build an operating system that could run on a different brand of machine. In 1969, Ken Thompson began writing the first line of code that later became Unix. (Thompson has participated in a project: Multics,unix is a joke about this) in fact, Dennis Ritchie designed a new programming language for this new operating system--C language, things really started.

Although Unix is less efficient than the original operating system, it has three outstanding advantages: it can be ported to other machines, where the C language greatly simplifies programming, and these are free. Soon, universities all over America are busy starting to install Unix for machines.

2. Terminal (terminals)

Unix is an operating system that can run on many kinds of machines, but how do people use these machines? They are connected to these machines by means of dumb terminals, which are connected to the central computer (computer) by a machine consisting of a keyboard, a display, and enough electronics (electronic components). On these terminals, the user can knock the character (Teletypy), which is the string ' tty ' representing the terminal equipment file, and the ' Getty ' Command's name history.

You might ask, where are these things now? These terminals are not able to achieve a final standard, which causes each brand of terminals have their own keyboard layout, the respective display of characters on the screen method, send or receive what signals to indicate what characters, control code and so on.

To avoid this confusion, we created a (capability) file containing all the different terminal features, which is ' termcap '. Use a tool to open '/etc/termcap ' Look, don't be alarmed;

Most Linux terminals use ' vt100 ' or ' Linux ' as the terminal type.

3, Xterms

In the early 80, a Unix graphics subsystem-the X Window System-was created. In the early 90, to better implement the applications of Intel-based Unix class systems (such as FreeBSD, NetBSD, Linux), a system branch-XFREE86 was created.

One of the great benefits of X Window is that you can run multiple virtual terminals. Even under X Window, there is an application-' xterm '. You will find that ' xterm ' and ' virtual terminal ' are the same in many cases. Some places say ' open a xterm ', in fact, you do not have to use the ' xterm ' program, the other Terminal simulator (terminal emulator), such as RXVT, Konsole, Aterm, Eterm, Wterm, and so on, as effective.

A terminal simulator (also known as a virtual terminal) is connected to the system through a pseudo (pseudo) TTY device-Pty and uses its own display standard-xterm. This leads to different terminal simulators that may have small differences in some keys or programs, depending on how much the simulator adheres to the ' xterm ' display standard.

4, Shells

In order to run the program in the terminal, you need the shell. The shell is part of the operating system that is used to deal with users and can be used to coordinate commands.

The first real Unix shell-' sh ', also known as the ' Bourne Shell ', was born in 1975, and the author is Steve Bourne. Soon there were other shells, such as the ' Ksh ' and ' zsh ', based on the original ' Bourne Shell ', which used to be standard shells in the exclusive unixes system; There are also shells derived from the C language, such as ' csh ' or ' tcsh '.

In Linux, the tagged shell is ' bash ', the GNU bourne-again shell (a bit of a joke ...). )。 The shell is very powerful (and some people think it's too big), and the Compressed man page has a KB.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.