The difference between terminal, shell, bash

Source: Internet
Author: User


Best Answer
    1. Terminal, the so-called command-line interface, also known as the command terminal, the user entered the shell command with the window, and the DOS interface in Windows similar.

    2. Shell, Shellis the shell between theuser and the operating system, intermediary, GUI and CLI are shell, landing terminal can be landed bash may be csh or dash; is the interface that the operating system interacts with the user, and the shell can be used in the command terminal. The shell translates user input into instructions that the operating system can handle. The shell provides some built-in commands and also supports calling out tools.

    3. Dash, is the default shell in Ubuntu. There are a variety of shells, in addition to supporting the default POSIX standard also support different extension syntax, currently most commonly used is bash, many shell learning tutorials are for bash. In addition to not supporting arrays, Dash doesn't really have much difference with bash. In Ubuntu, you can change the default shell from dash to bash.

Second article:

Terminal (terminal, or physical terminal):
is a device, not a program, typically a device that provides a command-line user interface, typically a screen and keyboard, or some other physical terminal.
Virtual Terminal:
Screen and keyboard is only a terminal, may not be enough, and do not want to increase equipment input, resulting in a virtual terminal.
Gnome-terminal,urxvt,mlterm,xterm et cetera:
is a program, the responsibility of the analog terminal, and the difference between the virtual terminal surface is that it appears in the GUI form of the window, the internal program structure and system control structure is different, but essentially similar.
Console:
The terminal that displays the system message is called the console, the Linux default all virtual terminal is the console, can display the system message.
But sometimes it refers to the CLI of the analog terminal equipment, a program, and Gnome-terminal,urxvt,mlterm,xterm, and so on, just the CLI and GUI interface differences. General console has 6, TTY1-6,CTRL+ALT+FN switch. Haven't heard how to change the console.

Shell is an abstract concept, the shell of all operations in the computer, responsible for the processing of human interaction, execution of scripts, etc., is the operating system is an important part of the normal operation
BASH,ASH,ZSH,TCSH is a concrete implementation of the abstract concept of the shell, which is a program that can generate a process object.
If you want to change the shell of the program, you can modify the/etc/passwd, the inside of the/bin/bash to replace the shell you want, or with chsh command to switch

Shell-to-terminal relationship: The shell transports some information to the terminal, and also receives input from the terminal. In general, each shell process will have a terminal association, or it may not.

Of course, there are some different views, I think this summary is good, for reference only!

In addition, Wikipedia also speaks of:

Character Programs <---> virtual terminal <---> image display
Shell <---> xterm <---> X11
Visible xterm is indeed the so-called "virtual terminal"!

 

    Today I see people asking the difference between the terminal and the console, and the problem is more universal, so try to take a moment to explain the differences between the two terms.   Terminal, English is called terminal, usually referred to as term, such as our xterm under X.   Console, English is called console.   To understand the relationship between the two, you have to start with a computer used by many people. As we all know, the initial computer is expensive, so a computer is usually used by multiple people at the same time. In this case, a computer needs to connect many sets of keyboards and monitors for more than one person to use. In the past, there is a device that can connect to a computer, only a monitor and keyboard, and a simple processing circuit, which itself does not have the ability to process computer information, he is responsible for connecting to a normal computer (usually through the serial port), then log on to the computer and operate on the computer. Of course, the computer operating system at that time is multi-tasking multi-user operating system.   A device that only displays and keyboards can be connected to a computer via a serial port is called a terminal. And what about the console? The person who learns the electromechanical should know, a machine tool, or the control box of the numerical control equipment, usually be called the console, as the name implies, the console is a direct control equipment of the countertop (a panel, which has a lot of control buttons). In the computer, the keyboard and the monitor connected directly to the computer are called consoles. Please note the difference between it and the terminal, the terminal is connected through the serial port, not the computer itself has some equipment, and the console is the computer itself has a device, a computer has only one console. When the computer starts, all information is displayed to the console, not to the terminal. In other words, the console is the basic device of the computer, and the terminal is an additional device. Of course, because the console also has the same function as the terminal, the console is sometimes blurred to collectively known as the terminal.   In the computer operating system, information unrelated to the terminal, such as kernel messages and background service messages, can be displayed on the console, but will not appear on the terminal. These are the legacy differences between console and terminal. Now that computer hardware is getting cheaper and more expensive, it's usually a person who has a computer that is super-done, and no longer connects to the "end-device" in the real sense of the past, so the concept of terminals and consoles has evolved slowly.   Terminals and consoles evolved from the concept of hardware into the concept of software. Now the terminal, such as the virtual terminal in Linux, is the concept of software, he uses the computer software to simulate the way the previous hardware. For example, in Linux, you can switch six virtual terminals with ALT+F1 ~ F6, which is the reason why this is called "Virtual terminal", as it is the six terminal equipment in the computer which was used by many people. Now, of course, Linux is alsoCan connect a real terminal through the serial line, now this kind of terminal equipment has been very rare, but still exist, only the average person is very difficult to see. Some people used the old computer (386,486) to install a serial communication software, connected to a computer, to simulate a terminal to use.   This can achieve a computer for many people to use the purpose. Simply put, the terminal that can display system messages directly is called the console, others are called terminals.   But in the Linux system, the concept has also been blurred. For example, the following command: Echo "Hello,world" >/dev/console The purpose of this command is to display "Hello,world" to the console/dev/console is the device name of the console device. In Linux, in character mode, the character Hello,world is displayed under the current virtual terminal, regardless of the virtual terminal under which you execute the command. In other words, Linux treats the current terminal as a console. It can be seen that the difference between consoles and terminals has been completely diluted in Linux. But in other Unix-like systems, there is a clear difference between a virtual terminal and a console.   such as the FreeBSD system. In FreeBSD, only the first "terminal" is a real console. (That is, the virtual terminal that is obtained by ALT+F1), you execute the above command on whichever virtual terminal (even if the command is executed on a pseudo terminal connected via the network). Hello,world characters are always displayed to the first "terminal", which is the real console. In addition, other internal information of the system, such as which user at which terminal login, the system has any serious error warning information, all displayed on this real console. Here, the concept of terminal and console is clearly distinguished. The same is true of other Unix. For example, Tru64 Unix has a console emulation software under X, and wherever you enter the echo "Hello,world" >/dev/console commands, Hello,world is always displayed in this console emulator. The software that we use to enter commands in the X interface, such as Xterm, RXVT, gnome-terminal, etc., should be called terminal emulation software. Note the difference between it and the console emulation software. Linux seems to have no console emulation software. The output information of the echo "Hello,world" >/dev/console command entered in the terminal emulation software in X is output to the virtual terminal on which the X server is launched. For example, you log into the system in a character way. Enter the first virtual terminal, and then startx start the x server. Then open xterm to lose.Into the echo "Hello,world" >/dev/console command, the string Hello,world is displayed on the first virtual terminal.   You press CTRL+ALT+F1, go back to the terminal that started the X server, you can see the Hello, world string. Now it's time to understand the difference between the terminal and the console.   To put it simply, the console is a direct connection to the computer's native device, the terminal is through the cable, network and so on and the host connected devices. In the previous hardware terminal equipment, due to different manufacturers, the standards are different, so there are different model standards. such as VT100 and so on. The VT100 here is a standard, so now we call the terminal, is often not the real hardware terminal, but the terminal simulation software, so different terminal simulation software may meet different standards, there are some terminal simulation software to meet many different terminal standards. For example, GNOME's terminal emulation software, Gnome-terminal, offers several standards for users to choose from.   The user can just set it up a bit. Now, as the original equipment in our eyes gradually fade away, the concept of console and terminal also slowly talk about. Ordinary users can simply understand the terminal and the console as: You can enter the command line and display the program running the process of information and the results of the program's window. It is not necessary to make a strict distinction between the two.

The difference between terminal, shell, bash

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.