Linux笔记

2020.06.11

1. linux的常用命令

linux常用命令 (3y)

2. 删除以.xxx结尾的文件

2020.06.17

解决apt-get下载速度慢

①. 先安装wget命令及备份原文件:

//安装wget命令
yum install -y wget 

//对CentOS-Base.repo备份
 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

②. 下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 6:
阿里源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-6.repo
163源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163/.help/CentOS6-Base-163.repo

CentOS 7:
阿里源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-7.repo
163源:wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163/.help/CentOS7-Base-163.repo

③. 下载完成后,修改源文件连接为https

vim /etc/yum.repos.d/CentOS-Base.repo,将里面所有的http修改为https

④. 最后清理升级并重新生成缓存

yum clean all && yum makecache

批量替换

2.1 将文件1.txt内的文字“garden”替换成“mirGarden”

 //sed -i 很简单
 sed -i "s/garden/mirGarden/g" 1.txt

2.2 将当前目录下的所有文件内的“garden”替换成“mirGarden”

//其实也就是ls出多个文件名而已
sed -i "s/garden/mirGarden/g" `ls` 

2020.06.21

java -version 出现pick up JAVA_OPTIONS

vim /etc/profile //配置环境变量
在里面添加 unset _JAVA__OPTIONS
source /etc/profile //使配置生效

更多推荐

Linux笔记