Chinaunix首页 | 论坛 | 博客
  • 博客访问: 383396
  • 博文数量: 138
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1620
  • 用 户 组: 普通用户
  • 注册时间: 2013-03-10 16:55
个人简介

当你比别人优秀一点点,别人会嫉妒你。当你比别人优秀很多,别人会羡慕你。

文章分类

全部博文(138)

文章存档

2016年(2)

2015年(2)

2014年(15)

2013年(119)

我的朋友

分类: LINUX

2014-05-21 16:55:03


Console是一个逻辑的东西,它是一个接口。是内核和外界交互的接口。

下面的终端,虚拟终端,都可以注册为console设备。然后接受内核的消息。



*****************************************************************************

终端,是一个设备,物理设备,once upon a time

往往一个简单的哑终端就可以了。

*****************************************************************************

虚拟终端,是一个应用程序。


    Virtualy Terminals are merely programs that send keystrokes and recieve output (this is called Standard In, Standard Out[ and Standard Error]) to a process in the background.
            This is a basic inputprocessingoutput system, and is at the heart of your operating system.

虚拟终端是一个程序,这个程序和后台的一个进程进行交互。它发送数据进去,然后接受输出,然后显示出来,这是一个非常基本的输入,处理,输出体系。

后台那个程序是什么???


1alt+1....alt+7 是虚拟终端。

2)启动图形界面后:

xterm是一个虚拟终端,是个应用程序。

gnome-terminal是一个和xterm一个level的东西,也是一个虚拟终端,不同的是,xterm是基于X-windows的,gnome-terminal是基于gnome这个窗口管理器的。

3)我们用putty远程登录linux的时候,我们的putty也是一个虚拟终端,不过跟它交互的是sshd


*****************************************************************************

tty

A TTY is essentially a pseudo device, call it a kernel resource, which is used by processes to access a specific terminal. TTYs can be tied to hardware such as a serial port, or can be virtual, eg created when a user log in via a network.

tty是一个虚拟设备/伪设备,这是一种内核资源。它被程序所使用,tty可以被绑定到一个硬件,比如说一个串口,或者一个虚拟终端,供程序来使用它。


*****************************************************************************

shell

The shell is a program which is used for controlling and running programs. It is often used interactively, via a terminal. Several Shell programs exist, Bash being arguably the most common used shell today.
        Other shells, in no particular order, includes Bourne Shell, C-shell, Dash, Tsch, Ksh, and the increasingly popular zsh. There are many more.

A Terminal Emulator often starts a Shell to allow you to interactively work on a command line.

shell是一个程序,他init进程启动bash csh ksh,他用于和用户交互,有很多种shell


Linux 命令行和shell脚本编程大全:

系统启动的时候,linux会自动创建7个虚拟终端。我们在虚拟终端中输入用户名密码后,会自动带入到linux bash shell中。alt+1那几个是虚拟终端,是应用程序。当用户登录后,会自动运行shell程序,bashkshcsh等等。

由此我们可以自己推理:

Xtermgnome-terminal等也都是虚拟终端,只不过我们打开他们的前提,是使用用户名密码登录进入了系统。xterm,已经启动了Xwindowsgnome-terminal已经启动了gnome。那么系统自动的使用我们的用户名密码,登录了虚拟终端xtermgnome-terminal。然后自动启动了shellbashcsh等等,然后等待我们和用户交互。



我们在图形界面上新打开一个terminal

[toqu@bl1223 ~]$ echo $$

28683

这个是当前进程的进程号,这个就是sh这个进程的进程号

[toqu@bl1223 ~]$ ps -ef |grep 28683

toqu 28683 6408 0 16:20 pts/8 00:00:00 -sh

而这个进程是由 gnome-terminal这个6408号进程启动的

[toqu@bl1223 ~]$ ps -ef |grep 6408

toqu 6408 1 0 May09 ? 00:03:34 gnome-terminal

从这里可以看出,这个gnom-terminale1号进程启动的。

这也验证了这个过程。




http://blog.csdn.net/a954423389/article/details/7300346




这个terminfo数据库:

终端模拟包可以模拟不同的终端,那么需要一个途径让linux系统知道你使用的是具体的哪个终端。linux需要知道和终端模拟器通信的时候,使用哪些控制码。


linux内核是一头,他有配置文件,配置文件归内核所用,我们的软件(xterm)是一头。

这是通过一个环境变量 TERM和一组称之为 terminfo数据库的特殊文件来实现的。


Linux shell使用TERM环境变量来定义对特定对话使用terminnfo数据库中的哪个终端模拟设置。
      当TERM环境变量为vt100的时候,shell就知道使用跟vt100 terminfo数据库条目关联的控制码来向终端模拟器发送控制码。


xterm后面用到再研究吧。

阅读(964) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~