linux时间加其他字符,字符集修改、Linux时间同步、调整文件描述符(示例代码)
发布日期:2022-02-10 01:26:38 浏览次数:5 分类:技术文章

本文共 2129 字,大约阅读时间需要 7 分钟。

字符集

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

转载地址:https://blog.csdn.net/weixin_33595317/article/details/116809368 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:计算机网络linux简答题,计算机网络简答题
下一篇:linux内核模块读取网络信息,Linux内核模块使用指南

发表评论

最新留言

表示我来过!
[***.240.166.169]2024年04月12日 12时01分54秒