关闭CentOS6不必要的tty,centos6tty


CentOSLinux系统默认是打开6个控制台,分别可以用 ALT+F1 到 ALT+F6 进行访问,6个控制台默认都驻留在内存中,用ps-aux可以查看:

[root@localhost ~]# ps -aux | grep tty

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root 1048 0.0 0.0 1980 484 tty1 ss+ 04:49 0:00 /sbin/mingetty /dev/tty1

root 1050 0.0 0.0 1980 484 tty2 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty2

root 1052 0.0 0.0 1980 484 tty3 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty3

root 1054 0.0 0.0 1980 484 tty4 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty4

root 1056 0.0 0.0 1980 480 tty5 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty5

root 1058 0.0 0.0 1980 476 tty6 Ss+ 04:49 0:00 /sbin/mingetty /dev/tty6

root 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/tty1

task

script

. /etc/sysconfig/init

for tty in $(echo $ACTIVE_CONSOLES) ; do

[ "$RUNLEVEL" = "5" -a "$tty" = "$X_TTY" ] && continue

initctl start tty TTY=$tty

done

end script

在打开/etc/sysconfig/init

找到

ACTIVE_CONSOLES=/dev/tty[1-6]

修改为:

ACTIVE_CONSOLES=/dev/tty[1-2]

重启即可!

相关内容

    暂无相关文章