1.排序展现该目录下文件
du -sch ./* |sort -hr|head -20
2.linux服务器增加中文字体
yum -y install fontconfig
cd /usr/share/fonts/
mkdir chinese
scp root@192.168.1.1:/opt/simsun.ttc /usr/share/fonts/chinese
fc-cache
fc-list
3.服务运行出现打开文件数过大报错
研发判断,没有滞留进程打开文件,均实时释放,所以考虑加大open files。
ulimit -a
查看打开文件
lsof
查看文件打开数量
lsof |wc -l
查看某一个进程打开文件数量
lsof -p 'sid' |wc -l
修改配置文件,永久生效:
sudo vim /etc/security/limits.conf
--------------
* soft nofile 2048
* hard nofile 2048
---------------------
临时生效修改:ulimit -n 2048
如果sudo无法执行,未知命令,则:
sudo sh -c "ulimit -n 2048 && exec su $LOGNAME"
切换到root用户
sudo su
sudo su - root
4.修改时间
查看硬件时间
hwclock --show
设置硬件时间
hwclock --set --date="11/8/18 14:05:20" (月日年 时分秒)
hwclock --hctosys
5.筛选出符合的,然后执行命令
sudo find /opt/ -name "*.tgz" -type f -mtime +7 -exec ls -l {} ;
-type f 普通用户
-mtime+7 距离现在七天
-exec ls -l {} ; 给查出的这些文件执行ls -l命令
6.时区问题
timedatectl list-timezones |grep Shanghai
timedatectl set-timezone Asia/Shanghai
7.动态清空文本:
echo>***.log
8.手动释放内存
释放前一定要sync,将内存中的输几局存储到硬盘(有可能部分需要存储的临时文件还在内存中)
#sync
#echo 3 > /proc/sys/vm/drop_caches
9.tmp不自动删除某目录
vim /usr/lib/tmpfiles.d/tmp.conf
添加
x /tmp/poifiles.*