Detection third week

01. vi Editor works, if there is a sudden interruption to edit, how to restore the original data
it works:
1. The use of vim /oldboy/test.txt command to open the file (generate a hidden file)
2. Go to the command mode
3. Input i for editing files
4. press esc exit edit
5. command mode press: wq (hidden file rename overwrite the original file)

exception recovery:
R & lt key
VI -R & lt /oldboy/test.txt
RM -f hidden files

how 02. View linux system whether to open the 8080 port services?
  -lntup netstat | grep 8080
  SS -lntup | grep 8080
  the -l List information list display
  -n number port information is displayed digitally
  -t tcp tcp protocol information display
  -u udp udp protocol information display
  -p protocol whether to display the service process information


03. vim in all the commands given oldboy replaced oldgirl
 

04. Linux kernel boot time, read from () to load the file system information file / etc / fstab
[the root @ localhost Oldboy] CAT # / etc / fstab

#
# /etc/fstab
# Created by anaconda on Sun Sep 8 00:01:03 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root / xfs defaults 0 0
UUID=7f73f94e-5ab8-4cc9-a1ba-6314c5498d50 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0

Linux文件属性中每个普通文件用 () 来标识 -

05. vim中如何忽略大小写搜索指定信息,给出忽略大小写方法(至少两种方法)
:set ic
/搜索信息\c

06. 用命令行更改config.txt文件, 把里边所有的"name"更改为address (vim和sed命令分别如何实现)
:%s#name#address#g


【方式一:sed -i.bak 's#name#address#g' config.txt】
[root@localhost oldboy]# vim comfig.txt

[root@localhost oldboy]# ls
comfig.txt oldboy.txt

[root@localhost oldboy]# sed -n "s#name#address#gp" comfig.txt
my address is zhanghongqi

[root@localhost oldboy]# sed -i.bak "s#name#address#" comfig.txt

[root@localhost oldboy]# ls
comfig.txt comfig.txt.bak oldboy.txt

[root@localhost oldboy]# cat comfig.txt
my address is zhanghongqi
i an oldboy student
yes,this is ok!

07. 管道符号的含义说明 |
将前一个命令执行的结果交给后一个命令进行处理

管道符号传输信息的原理:
01. 获取的信息是一行一行的信息 借助xargs 将多行转为一行
02. 获取的信息会传输到管道右边命令的最后面
find /xxx -name "xxx"|xargs -i cp {} /tmp

08. 搜索文件中指定文本内容的方法,给你具体操作命令 (至少三种方法)
grep 搜索信息 文件信息
sed -n '/搜索信息/p' 文件信息
awk '/搜索信息/' 文件信息

find 根据文件名

09. 在/oldboy/oldboy.txt文件中查找出包含 hello-shanghai 的所有信息 并显示行号
grep -n 'hello-shanghai' /oldboy/oldboy.txt

10. 按照以下文件信息
oldboy01
oldboy02
oldboy03
oldboy05
oldboy06
oldboy07
请输出oldboy03信息的上2行 和 下3行信息

grep -A 3 -B 2 "oldboy03" 文件信息

11. 需要给/oldboy/oldboy.txt文件创建一个软链接文件/tmp/oldboy_link.txt
如何进行,如果源文件删除了, 软链接文件是否会失效
ln -s /oldboy/oldboy.txt /oldboy/oldboy.txt_link
源文件被删除,链接文件即失效

12. 系统安全优化涉及什么,并写出安全优化的操作步骤以及操作命令?
防火墙优化
临时关闭
systemctl stop firewalld
永久关闭
systemctl disable firewalld
关闭selinux
临时关闭 setenforce 0
永久关闭 vim /etc/selinux/config -- SELINUX=disabled

13. 防火墙服务配置完毕后,如何检查防火墙服务已经处于关闭状态,并且没有开机自启动
systemctl status firewalld
systemctl is-active firewalld
systemctl is-enabled firewalld.service

14. rm命令修改了别名信息的文件/etc/profile,但还是不能直接删除信息,是什么原因
并写出和别名设置相关的文件及路径信息

家目录中的文件配置优于/etc目录文件的配置

/etc/profile
/etc/bashrc
设置别名或变量可以全局生效

~/.bash_profile
~/.bashrc
设置别名或变量只是相应用户生效
====================================================

在家目录中有文件中设置了别名

/etc/profile /etc/bashrc
~/.bashrc ~/.bash_profile

15. 字符集进行优化方法

/etc/locale.conf
====> LANG=en_US.UTF-8


16. 说说这些特殊符号含义: > >> 2> 2>> #(井号) .(点) ..(两个点) $ | && ;
> 标准输出重定向符号 覆盖文件内容
>> 标准输出追加重定向符号 文件中追加新的内容
# 注释符号 文件信息注释
. 表示隐藏文件
.. 表示会生成序列信息/或上一级目录 {01..02}
$ 表示一行的结尾
| 管道符号
&& 表示前一个命令执行成功,再执行后面的命令

17. linux系统中文件属性信息都包含什么
01. 文件索引节点 inode
02. 文件类型说明和文件权限
03. 文件硬链接数
04. 文件属主信息
05. 文件属组信息
06. 文件大小信息
07. 文件修改时间信息

18. 默认情况下管理员创建了一个用户,就会在()目录下创建一个用户主目录
/home

19. 说出下面几个文件的作用
/var/log/messages 系统和程序运行情况信息保存日志文件
/var/log/secure 用户登录系统情况日志文件
/etc/hosts IP地址和主机名称对应关系记录文件
/etc/fstab 实现磁盘文件自动挂载文件
/etc/rc.local 实现操作命令启动系统自动加载文件

20. 将配置文件中注释信息去除掉显示,有什么办法(至少三种方法)
1. 利用vim批量删除功能进行删除
2. 利用grep命令排除功能进行删除
3. 利用sed命令进行替换删除

21. 按照以下文件信息
日志文件一直在不断变化,如何实时监控日志文件变化 日志文件为/var/log/messages
tail -f/F /var/log/messages

22. 如何创建一个新的oldgirl用户,并且需要给用户设置密码,并且采用免交互方式创建密码
useradd oldgirl; echo 123456|passwd --stdin oldgirl
useradd oldgirl && echo 123456|passwd --stdin oldgirl

23. 如何批量创建出 oldboy01 oldboy02 .. oldboy20 总计20个文件
touch oldboy{01..20}

24. yum安装软件的时候,只知道软件安装完可能会使用的命令,但忘记了软件包名称如何处理?
yum provides 软件命令 ssh openssh

yum命令常用的参数
yum install -y
yum groupinstall -y
yum reinstall -y xxx
yum provides
yum repolist 显示yum仓库信息
yum list 显示安装和没有安装的所有软件信息
yum grouplist 显示安装和没有安装的所有软件包组信息

25. 如何统计出oldboy.txt文件中oldboy信息出现的行数总计有多少,请写出命令
grep -c oldboy oldboy.txt

26. 运维同事在/etc目录中创建了一个文件,但没有告知你文件名称,如何快速找出最新创建的文件
ls -rtl /etc

27. 如何查看系统的信息
uname

28. echo "oldboy"|tr "oldboy101" "oldgirl123" 请写出命令结果信息?
ildgir

29. 修改系统字符集方法?
localectl set-locale LANG="en_US.UTF-8"

30. 写出目前所学习的20个命令,并写出作用
根据自己掌握情况进行写出

Guess you like

Origin www.cnblogs.com/zhanghongqi/p/11578562.html