linux时间加其他字符,字符集修改、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"

en_US.UTF-8

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

zh_CN.UTF-8

然后改CRT中的字符集:会话选项-->外观-->字符编码-->utf-8 即可。

时间服务:

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

修改时间:

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

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

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

保存时间:

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服务:

aed7ab16e7d1aaf024afe4407198744e.png

af2dda14170aa96ce8a3c572ca60051a.png

为CRT设置超时控制:

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

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

永久设置超时控制

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

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

查看:

1000

历史记录控制:

历史记录只保存5行的设置:

查看:

562  history

563  HISTORY=5

564  history

565  HISTSIZE=5

566  history

或者用以下方式修改:

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

564  history

565  HISTSIZE=5

566  history

567  export HISTORY=50

568  history

(被删掉了)

历史记录同时也存放在历史记录文件中,查看与修改历史记录文件:

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

[[email protected] ~]# HISTFILESIZE=5

清空现有的history,用-c参数:

569  cat ~/.bash

570  cat ~/.bash_history

571  HISTFILESIZE=5

572  cat ~/.bash_history

573  history

570  history

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

570  history

571  echo 123456|passwd --stdin keke

572  history

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

570  history

571  history

572  history -d 571

573  history

加大服务器文件描述符:

文件描述符基本为整数数字(0-65535)、

进程使用的时候会占用文件描述符,使用它来打开文件,标识打开的文件

查看默认文件描述符:

1024

调整文件描述符:(修改shell资源限制)

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

655354894e2d4811bb2e68ae5140dbcdcc9e8.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值