linux小知识之终端
(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
轉載于:https://blog.51cto.com/zhangdl/1791337
總結
以上是生活随笔為你收集整理的linux小知识之终端的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: html5标题怎么能不换行
- 下一篇: linux 系统、命令、软件