關閉CentOS6不必要的tty

來源:互聯網
上載者:User

關閉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]

重啟即可!

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.