歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> 關閉CentOS6不必要的tty

關閉CentOS6不必要的tty

日期:2017/3/6 9:14:45   编辑:學習Linux

關閉CentOS6不必要的tty


關閉CentOS6不必要的tty


CentOSLinux系統默認是打開6個控制台,分別可以用 ALT+F1 到 ALT+F6 進行訪問,6個控制台默認都駐留在內存中,用ps-aux可以查看:

[root@localhost ~]# ps -aux | grep ttyWarning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQroot 1048 0.0 0.0 1980 484 tty1 ss+ 04:49 0:00 /sbin/mingetty /dev/tty1root 1050 0.0 0.0 1980 484 tty2 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty2root 1052 0.0 0.0 1980 484 tty3 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty3root 1054 0.0 0.0 1980 484 tty4 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty4root 1056 0.0 0.0 1980 480 tty5 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty5root 1058 0.0 0.0 1980 476 tty6 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty6root 1133 0.0 0.1 4328 728 pts/0 S+ 05:44 0:00 grep tty

事實上沒必要需要使用這麼多,CentOS 6.0 開始 TTY 的配置由/etc/inittab更改為/etc/init/start-ttys.conf,執行以下命令可將默認6個 TTY 改為2個:

找到 tty [1-6] 改成 tty [1-2]

[root@localhost ~]# vim /etc/init/start-ttys.conf## This service starts the configured number of gettys.start on stopped rc runlevel=[2345]env ACTIVE_CONSOLES=/dev/tty[1-2]env X_TTY=/dev/tty1taskscript        . /etc/sysconfig/init        for tty in $(echo $ACTIVE_CONSOLES) ; do                [ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue                initctl start tty TTY=$tty        doneend script

在打開/etc/sysconfig/init

找到

ACTIVE_CONSOLES=/dev/tty[1-6]

修改為:

ACTIVE_CONSOLES=/dev/tty[1-2]

重啟即可!

http://xxxxxx/Linuxjc/1156010.html TechArticle

Copyright © Linux教程網 All Rights Reserved