商城首页欢迎来到中国正版软件门户

您的位置: 首页 > 文章列表 > 系统应用 > 修改solaris的默认语言

修改solaris的默认语言

  发布于2026-06-04 阅读(0)

扫一扫,手机访问

使用Solaris中文版安装后,不少朋友会遇到一个头疼的问题——通过SSH远程连接时,终端里显示的中文全是乱码,根本没法正常工作。其实问题的根源在于系统的默认语言设置,把locale切回英文模式就能搞定。下面直接上操作,干净利落。

先把配置文件的写权限打开,因为默认是只读的:

#chmod u+w /etc/default/init

接着用vi编辑这个文件:

#vi /etc/default/init

文件内容大致如下(版本注释之类的不用管,关键看后面几行):

#
# Copyright 1992, 1999-2002 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident  "@(#)init.dfl   1.7     02/12/03 SMI"
#
# This file is /etc/default/init.  /etc/TIMEZONE is a symlink to this file.
# This file looks like a shell script, but it is not.  To maintain
# compatibility with old versions of /etc/TIMEZONE, some shell constructs
# (i.e., export commands) are allowed in this file, but are ignored.
#
# Lines of this file should be of the form VAR=value, where VAR is one of
# TZ, LANG, CMASK, or any of the LC_* environment variables.  value may
# be enclosed in double quotes (") or single quotes (').
#
TZ=PRC
CMASK=022
LANG=EN //使用英文字体
#LANG=zh_CN.UTF-8  //原来默认的中文,注解掉

核心改动就两处:把 LANG 的值设为 EN(表示英文),同时把原来默认的 zh_CN.UTF-8 那一行注释掉。保存文件后重启系统,再通过SSH连接,中文乱码的问题自然就消失了。

这个小技巧在很多Sun/Oracle老系统上依然有效,尤其是那些还跑着Solaris 10甚至更早版本的环境。实测下来,修改后所有终端输出都变成了英文,既避免了编码混乱,也方便远程管理。当然,如果你需要保留中文界面但解决乱码,那就要另外配置SSH客户端的编码了,但那是另一个话题。

本文转载于:https://www.jb51.net/os/Solaris/1692.html 如有侵犯,请联系zhengruancom@outlook.com删除。
免责声明:正软商城发布此文仅为传递信息,不代表正软商城认同其观点或证实其描述。

热门关注