第九天

第九天

显示一个文件的前3行用什么命令:

head -n 3 文件名

显示一个文件的最后10行文件什么命令:

tail -n 10 文件名

tail head more less 都记一下

1.一个软件安装好了 如果利用rpm命令卸载

rpm -e 软件包名

  1. 安装一个软件有几种方法说下:
yum install 软件名

dnf install  软件名

apt install 软件名
使用源码编译安装

下载源代码包并解压

进入解压后的目录

配置、编译、安装
./configure
make
make install


使用vim 命令 操作下 并整理答案

默认没有安装vim 可以 安装vim 命令

删除光标所在行命令:dd

显示行号命令:set nu

跳转到n行命令::n

替换test为kai::%s/test/kai/g

查找test字符串命令:/ test

批量注释1到15行:1,15s/^/#/g

目录下创建test.txt文件,内容为:Hello, World! 用一个命令写出来

 echo "hello world\!" > test.txt



用vi编辑文件,需要把文中从21行到30行中所有的“/usr/local”改为“/root”,用一条语句怎么实现

:21,30s/usr\/local/usr\/root/g

yum源的更新

万事先备份
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
 
下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 163 的源
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
# centos6 系统更新源方式
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
# centos8 系统更新源方式
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
 
 
 
 
生成缓存,更新yum源
yum clean all
yum makecache
yum -y update

登录服务器提升如下提示 实战演示 写出操作方法

Connecting to 192.168.100.100:22...

Connection established.

To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Sun Nov 5 23:44:18 2023 from 192.168.100.1

*生产服务器请慎重操作慎用rm命令

yum -y install nano
或者可以不用装,直接vi打开
vi /etc/motd
粘贴内容**************生产服务器请慎重操作慎用rm命令*************

reboot


image-20240309130121714

posted @ 2024-03-09 18:35  三思博客  阅读(4)  评论(0编辑  收藏  举报