Additional Resources
Introduction to File system
soft link 和 hard link 的补充
hard link 是直接连接源文件的 inode 的. 而 soft link 不是
如果是创建的 hard link , 修改了源文件的内容, link 里面的内容也会跟着一起修改
program and service management
Absolute path & Relative path
Combining and Splitting Files
Filter / Text Processors Commands
注意, 在使用 uniq 的时候,前面要先 sort . 即
file | grep xxx | sort | uniq
Environment Variables
Monitor Users
‘sed’ command
sed 's/^$/ /g'
^
表示一行的开头,$
表示一行的结尾/^$/
表示这一行为空
sed 's/\t/ /g'
\t
表示 tap 键
sed '8!s/var1/var2/'
8!
表示出了第八行,其他的都替换
Log Monitoring Addition
system monitoring
dmesg
表示 error 或者 fail , warning 的 message; 即 display message
netstat -rnv
查 gateway 等网络信息
free
physical mem and swap virtual mem
Rollback Updates and Patches
降级
- 安装 httpd
yum install httpd
[root@localhost ~]# yum install httpd
Last metadata expiration check: 1 day, 23:17:30 ago on Mon 20 Sep 2021 05:52:58 PM EDT.
Package httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
- 查询 rpm
rpm -qa | grep httpd
[root@localhost ~]# rpm -qa | grep httpd
centos-logos-httpd-85.8-1.el8.noarch
httpd-filesystem-2.4.37-40.module_el8.5.0+852+0aafc63b.noarch
httpd-tools-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64
httpd-2.4.37-40.module_el8.5.0+852+0aafc63b.x86_64
- 查看历史记录
yum history
[root@localhost ~]# yum history
ID | Command line | Date and time | Action(s) | Altered
--------------------------------------------------------------------------------
11 | -y install sysstat | 2021-09-12 20:45 | Install | 2
10 | -y install git | 2021-09-10 19:19 | Install | 6
9 | -y install telnet | 2021-09-10 11:12 | Install | 1
8 | install httpd | 2021-09-07 15:40 | Install | 9
7 | -y install lrzsz | 2021-08-21 08:17 | Install
- 选择你需要 downgrade 的
yum history undo 8
[root@localhost ~]# yum history undo 8
Last metadata expiration check: 1 day, 23:58:58 ago on Mon 20 Sep 2021 05:52:58 PM EDT.
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Complete!
- 再查询安装包
rpm -qa | grep httpd
已经没有了
[root@localhost ~]# rpm -qa | grep httpd
[root@localhost ~]#
升级 update
upgrade
(upgrade 会删除原来的,慎用)
[root@localhost ~]# yum update
CentOS Stream 8 - AppStream 7.1 kB/s | 4.4 kB 00:00
CentOS Stream 8 - BaseOS 7.5 kB/s | 3.9 kB 00:00
CentOS Stream 8 - Extras 7.3 kB/s | 3.0 kB 00:00
Securing Linux System
remove rpm rpm -e $pckname
[root@localhost ~]# rpm -qa | grep sql
sqlite-3.26.0-13.el8.x86_64
sqlite-libs-3.26.0-13.el8.x86_64
msodbcsql17-17.8.1.1-1.x86_64
mssql-server-15.0.4153.1-6.x86_64
mssql-tools-17.8.1.1-1.x86_64
[root@localhost ~]# rpm -e mssql-tools-17.8.1.1-1.x86_64
################### 验证 ############################
[root@localhost ~]# rpm -qa | grep sql
sqlite-3.26.0-13.el8.x86_64
sqlite-libs-3.26.0-13.el8.x86_64
msodbcsql17-17.8.1.1-1.x86_64
mssql-server-15.0.4153.1-6.x86_64