字元集修改、Linux時間同步、調整檔案描述符

來源:互聯網
上載者:User

標籤:linux安裝

字元集

UTF-8:非定長,1-4位元組,廣泛支援,應用最廣

GBK:定長,雙位元組,不是國際標準,支援的系統少


[[email protected] ~]# cat /etc/sysconfig/i18n 

LANG="en_US.UTF-8"

SYSFONT="latarcyrheb-sun16"

先備份:

[[email protected] ~]# cp /etc/sysconfig/i18n /etc/sysconfig/i18n.wuyike.20170411

改配置:

[[email protected] ~]# sed -i ‘s#LANG="en_US.UTF-8"#LANG="zh_CN.UTF-8"#g‘ /etc/sysconfig/i18n

[[email protected] ~]# cat /etc/sysconfig/i18n

LANG="zh_CN.UTF-8"

SYSFONT="latarcyrheb-sun16"

[[email protected] ~]# echo $LANG

en_US.UTF-8

[[email protected] ~]# source /etc/sysconfig/i18n

[[email protected] ~]# echo $LANG                

zh_CN.UTF-8


然後改CRT中的字元集:會話選項-->外觀-->字元編碼-->utf-8 即可。


時間服務:

[[email protected] ~]# date

2017年 03月 04日 星期六 18:57:16 CST

修改時間:

[[email protected] ~]# date -s "2017/04/11 20:38"

2017年 04月 11日 星期二 20:38:00 CST

[[email protected] ~]# date

2017年 04月 11日 星期二 20:38:05 CST

儲存時間:

[[email protected] ~]# hwclock

2017年04月11日 星期二 20時38分23秒  -0.344922 seconds


同步互連網時間:

[[email protected] ~]# /usr/sbin/ntpdate time.nist.gov

11 Apr 20:41:29 ntpdate[35435]: step time server 216.229.0.179 offset -604646.549696 sec


在crond上設定每隔5分鐘同步一次互連網

[[email protected] ~]# echo "*/5 * * * * /usr/sbin/ntpdate time.nist.gov" >/dev/null 2>&1" >>/var/spool/cron/root

或者啟動linux自動同步互連網程式:

[[email protected] ~]# /etc/init.d/ntpd start


NTP服務:


650) this.width=650;" src="https://s3.51cto.com/wyfs02/M02/8F/D0/wKioL1js06-DUuMXAADYF4TrZUE929.png" style="float:none;" title="時間伺服器架構小規模.PNG" alt="wKioL1js06-DUuMXAADYF4TrZUE929.png" />

650) this.width=650;" src="https://s2.51cto.com/wyfs02/M00/8F/D1/wKiom1js07DSbxcrAAEHyUxPEao993.png" style="float:none;" title="時間伺服器架構.PNG" alt="wKiom1js07DSbxcrAAEHyUxPEao993.png" />




為CRT設定逾時控制:

[[email protected] ~]# export TMOUT=10

[[email protected] ~]# timed out waiting for input: auto-logout

[[email protected] ~]$ 

永久設定逾時控制

[[email protected] ~]# echo "export TMOUT=10" >>/etc/profile

[[email protected] ~]# source /etc/profile

查看:

[[email protected] ~]# echo $TMOUT

1000


記錄控制:

記錄只儲存5行的設定:

[[email protected] ~]# HISTSIZE=5

查看:

[[email protected] ~]# history   

  562  history

  563  HISTORY=5

  564  history

  565  HISTSIZE=5

  566  history

或者用以下方式修改:

[[email protected] ~]# export HISTORY=50

[[email protected] ~]# history

  564  history

  565  HISTSIZE=5

  566  history

  567  export HISTORY=50

  568  history

(被刪掉了)


記錄同時也存放在記錄檔案中,查看與修改記錄檔案:

[[email protected] ~]# cat ~/.bash_history 

[[email protected] ~]# HISTFILESIZE=5


清空現有的history,用-c參數:

[[email protected] ~]# history

  569  cat ~/.bash

  570  cat ~/.bash_history 

  571  HISTFILESIZE=5

  572  cat ~/.bash_history 

  573  history

[[email protected] ~]# history -c

[[email protected] ~]# history

  570  history

或者只刪除某一行,用-d:

[[email protected] ~]# history

  570  history

  571  echo 123456|passwd --stdin keke

  572  history

[[email protected] ~]# history -d 571

[[email protected] ~]# history

  570  history

  571  history

  572  history -d 571

  573  history


加大伺服器檔案描述符:

檔案描述符基本為整數數字(0-65535)、

進程使用的時候會佔用檔案描述符,使用它來開啟檔案,標識開啟的檔案

查看預設檔案描述符:

[[email protected] ~]# ulimit -n

1024

調整檔案描述符:(修改shell資源限制)

[[email protected] ~]# ulimit -SHn 65535

[[email protected] ~]# ulimit -n

65535650) this.width=650;" src="https://s3.51cto.com/wyfs02/M01/8F/F2/wKiom1jt6A6yGrt0AAG0lb6hHyY075.png" title="調整檔案描述符.PNG" width="700" height="160" border="0" hspace="0" vspace="0" style="width:700px;height:160px;float:left;" alt="wKiom1jt6A6yGrt0AAG0lb6hHyY075.png" />









字元集修改、Linux時間同步、調整檔案描述符

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.