码迷,mamicode.com
首页 > 系统相关 > 详细

linux小知识之终端

时间:2016-06-21 14:07:17      阅读:207      评论:0      收藏:0      [点我收藏+]

标签:linux shell 终端

(1)linux默认一共有6个虚拟终端,这6个虚拟终端常驻内存,方便用户使用,当遇到进程挂起时,可以使用alt+fn(n对应1-6)组合键切换另一个终端,查找到该进程号杀死该进程,如下,可以看到有6个虚拟终端。

[root@wuhanhz ~]#ps aux | grep tty
root      2419  0.0  0.0   4064   532 tty4     Ss+  Jun17   0:00 /sbin/mingetty /dev/tty4
root      2421  0.0  0.0   4064   536 tty5     Ss+  Jun17   0:00 /sbin/mingetty /dev/tty5
root      2423  0.0  0.0   4064   532 tty6     Ss+  Jun17   0:00 /sbin/mingetty /dev/tty6
root     16423  0.0  0.0   4064   528 tty1     Ss+  11:06   0:00 /sbin/mingetty /dev/tty1
root     16424  0.0  0.0   4064   532 tty2     Ss+  11:06   0:00 /sbin/mingetty /dev/tty2
root     16425  0.0  0.0   4064   532 tty3     Ss+  11:06   0:00 /sbin/mingetty /dev/tty3

(2)这个虚拟终端可以在配置文件中修改虚拟终端数量

[root@wuhanhz ~]#vim /etc/init/start-ttys.conf
env ACTIVE_CONSOLES=/dev/tty[1-6]                              //比如将[1-6]改为[1-2]

[root@wuhanhz ~]# vim /etc/sysconfig/init

ACTIVE_CONSOLES=/dev/tty[1-6]                                     //将[1-6]修改为[1-2]

[root@wuhanhz ~]#reboot

[root@tarena ~]# ps aux | grep tty
root       1690  0.0  0.0   4064   536 tty1     Ss+  20:24   0:00 /sbin/mingetty /dev/tty1
root       1692  0.0  0.0   4064   528 tty2     Ss+  20:24   0:00 /sbin/mingetty /dev/tty2

(3)查看当前有多少个终端在被占用

who、w、uptime都可以查看有几个终端被占用,但是w可以显示更多的信息

[root@tarena ~]# w
 20:32:22 up 8 min,  1 user,  load average: 0.00, 0.02, 0.01

从上次开机到现在额时候,一个用户,负载值是:5分钟的,10分钟的,15分钟

USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    192.168.11.1     20:25    0.00s  0.12s  0.03s w

用户是谁,占用哪个终端,从哪来,cpu相关地 一些值,动作是什么

[root@tarena ~]# who
root     pts/0        2016-06-21 20:25 (192.168.11.1)
[root@tarena ~]# uptime
 20:32:46 up 8 min,  1 user,  load average: 0.00, 0.02, 0.00






本文出自 “11050780” 博客,请务必保留此出处http://11060780.blog.51cto.com/11050780/1791337

linux小知识之终端

标签:linux shell 终端

原文地址:http://11060780.blog.51cto.com/11050780/1791337

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!