1、查看日期信息date2、改硬件时间查看硬件时间hwclock --show设置硬件时间hwclock --set --date '2021-09-18 16:57:28'设置系统时间和硬件时间同步hwclock --hctosys让系统时间与硬件时间保持一致hwclock -s../../md/Linux服务器/
1、备份原配置文件mv /etc/yum.repos.d/CentOS-Linux-BaseOS.repo /etc/yum.repos.d/CentOS-Linux-BaseOS.repo.repo.backup2、下载阿里源的 reopswget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo3、替换部分字段(阿里云服务器跳过、自建服务器必做!)sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.rep
1、查看本地是否安装了中文字符集locale -a|grep CN2、如果没有,则安装中文环境yum install kde-l10n-Chinese -yyum install glibc-common -y3、修改配置编码项localedef -c -f UTF-8 -i zh_CN zh_CN.utf85、vi /etc/profile 追加export LC_ALL=zh_CN.utf86、执行生效source /etc/locale.conf../../md/Linux服务器/
1、创建存放日志文件夹mkdir /data/nginx_logs/2、创建分割日志脚本vim /usr/local/nginx/sbin/cut_nginx_logs.sh3、输入文件内容保存日志目录为:/data/nginx_logs/log_files_from 为 nginx.conf 配置的原始日志文件路径log_files_to 为新存放的日志文件路径#!/bin/bash #function:cut nginx log files log_files_from="/usr/local/nginx/logs/" log_files_to="/data/nginx
语法:[addr]s/源字符串/目的字符串/[option]全局替换命令:%s/源字符串/目的字符串/g[addr] 表示检索范围,省略时表示当前行。 “1,20” :表示从第1行到20行; “%” :表示整个文件,同“1,$”; “. ,$” :从当前行到文件尾; s : 表示替换操作 [option] : 表示操作类型 g 表示全局替换; c 表示进行确认 p 表示替代结果逐行
1、编辑定时任务vim /etc/crontab2、每天晚上21点46分重启服务器SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sun
问题描述rm -rf 删除Tomcat的日志文件 nohup.out 后,使用 df -h 命令发现磁盘大小信息不变,这个时候可以通过重启服务器来解决,也可以根据以下操作来解决:1、查找已经删除并未解锁的线程ls -ld /proc/*/fd/* 2>&1 | fgrep '(deleted)'2、kill 掉这些线程kill 2042343、优化方案清空指定文件即可:echo > nohup.out ../../md/Linux服务器/
永久修改sudo hostnamectl set-hostname <新的主机名>临时修改sudo hostname <新的主机名>../../md/Linux服务器/
1、基于 rpm【CentOS,Redhat】服务器常用sudo yum install nginx如果没有则添加仓库源文件:sudo vim /etc/yum.repos.d/nginx.repo #添加如下内容,后再进行上面的命令安装。 [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/7/$basearch/ gpgcheck=0 enabled=12、基于 deb【Debian,Ubuntu,Deepin】的安装sudo apt-get install nginx3、FreeBSD 的安装sudo pkg_install -r n
1、 find 文件搜索路径:/bin/find 语法:find [搜索范围][匹配条件] 用例:find /etc -name init #根据文件名来搜索,在目录/etec中查找文件init,精准查询 find /etc -name *init* #模糊查询,*匹配多个字符 find /etc -name init??? #模糊查询,?匹配单个字符 find /etc -iname init #不区分大小写查询 find /ho