hotplug
search:centos 8 hotplug network
https://forums.centos.org/viewtopic.php?t=76111
https://cromwell-intl.com/open-source/rhel-centos-5-6-7-8/networking.html
https://blog.csdn.net/axing_xyz/article/details/5305325
https://linux.die.net/man/8/hotplug
http://blog.sina.com.cn/s/blog_d2facf270101h7kt.html
http://blog.c1gstudio.com/archives/1703
https://forums.centos.org/viewtopic.php?t=25860
http://etutorials.org/Linux+systems/how+linux+works/Chapter+11+Configuring+and+Manipulating+Peripheral+Devices/11.5+Hotplug+Support/
lastb
显示尝试登陆我IP但失败的:lastb
登陆成功的:last
扫描某IP开放的端口:nmap ip -p 20-443
绑定别名
遇到过数次在:ls 一个目录里,无响应的情况,原因是执行 ls 时,终端会同时调用语法着色,造成假死,这同时,就需要为其绑定一个别名,以关闭语法着色
vim ~/.bashrc alias ll='ls -lt'1 alias ls="ls -f -1" # 避免任何统计调用,并立即打印所有内容,例:( time ls -f -1 | wc -l)可能花费不到5秒,但(time ls -f -C | wc -l)可能要花费30秒上 # See:https://unix.stackexchange.com/questions/120077/the-ls-command-is-not-working-for-a-directory-with-a-huge-number-of-files
卸载阿里云盾(安骑士)
# 卸载云助手守护进程 -> 停止云助手守护进程 [root@m ~] /usr/local/share/assist-daemon/assist_daemon --stop stop ok # 卸载云助手守护进程 [root@m ~] /usr/local/share/assist-daemon/assist_daemon --delete delete ok # 删除云助手守护进程目录 [root@m ~] rm -rf /usr/local/share/assist-daemon # wait AliYunDun process exit fail, possibly due to self-protection, please uninstall aegis or disable self-protection from the aegis console. ############################################################################################ wget http://update.aegis.aliyun.com/download/uninstall.sh chmod +x uninstall.sh ./uninstall.sh wget http://update.aegis.aliyun.com/download/quartz_uninstall.sh chmod +x quartz_uninstall.sh ./quartz_uninstall.sh
删除残留
pkill aliyun-service rm -fr /etc/init.d/agentwatch /usr/sbin/aliyun-service rm -rf /usr/local/aegis*
查看当前进程
pstree
打开 phpMyadmin 时,报错:
Error during session start; please check your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser. session_start(): open(SESSION_FILE, O_RDWR) failed: Permission denied (13) session_start(): Failed to read session data: files (path: /var/lib/php/session)
解决方案:
1、确保目录存在并具有适当的权限(1733)
[root@i ~] stat /var/lib/php/session | grep Access Access: (1733/drwx-wx-wt) Uid: ( 0/ root) Gid: ( 0/ root)
2、如果目录不存在,创建它并设置有效的权限:
[root@i ~] mkdir -p /var/lib/php/session && chmod 1733 /var/lib/php/session
3、如果目录存在,但权限不对,正确设置如下:
[root@i ~] chmod 1733 /var/lib/php/session
为 MySQL 开启日志事务(See01)
[root@i ~] vim /etc/my.cnf log-bin=bin.log log-bin-index=bin-log.index max_binlog_size=100M binlog_format=row socket=mysql.sock
systemctl status nginx 报错:
nginx.service: Can't open PID file /var/run/nginx.pid (yet?) after start: No such file or directory
解决方案:
[root@i ~] vim /lib/systemd/system/nginx.service [Service] ExecStartPost=/bin/sleep 0.1 [root@i ~] systemctl daemon-reload [root@i ~] systemctl restart nginx [root@i ~] systemctl status nginx
/bin/sh: lessc: command not found
在 make fancyindex 主题时,提示如上,解决方法如下:
dnf install npm npm install -g less
vim、rm command
- 全局替换当前文件中的所有 well 为 good(等同于 :g/well/s//good/g)
:%s/well/good/g
- vim 替换
# 语法 :[range]s/source/target/[option] # range表示要替换的范围,想要全局替换的话,可以使用一个百分号. :%s/xxx/xxxx # 另外,小数点表示当前行,美元符号表示最后一行,数字表示范围. :1,.s 替换第一行到当前行 :.,$s 替换当前行到最后一行 :1,$s 替换第一行到最后一行,相当于 :%s # source与target :1,.s/123/456 #表示把第一行到当前行的首次出现的123替换成456,注意是首次出现,如果要替换某一行全部源字符串需要在后面加上 /g # 另外,对于一些特殊字符比如小数点,斜杠,双引号等需要转义,方式是使用反斜杠,在需要转义的字符面前加一个反斜杠 如把 "123//" # 替换为 '123\\' # 命令如下: :s/\"123\/\/\"/\'123\\\\\'/g # 释义如下: "123//" 中 " 转义为 \" / 转义为 \/ '123\\' 中 ' 转义为 \' \ 转义为 \\
Option 选项下:
/g # 全局替换 /c # 确认 /p # 替换结果逐行显示 # 注意选项的组合结果是 /cg /pc # 这样的形式,而不是 /c/g /g/p # 这样的形式 # 全局替换的话,使用 :%s/source/target/g # 局部替换的话,使用 :n,ms/source/target # n,m为行数,表示要替换的范围. 注意如果字符串需要转义要加上反斜杠.
- rm 删除所有,保留特定文件
rm `ls *.txt|egrep -v test.txt` # 或者 rm `ls *.txt|awk '{if($0 != "test.txt") print $0}'` #排除多个文件 rm `ls *.txt|egrep -v '(test.txt|fff.txt|ppp.txt)'` rm -f `ls *.log.1|egrep -v '(access-2010-09-06.log|error-2010-09-06.log)'` rm -f `ls *.log|egrep -v '(access-2010-09-06.log|error-2010-09-06.log)'` rm -f `ls *.log|egrep -v '(20100906.log)'`
注意:上面所用的符号是‘`’,而不是单引号。
- rm 删除所有,保留 good 目录
rm -rf `ls |egrep -v bb`
- rm 删除特定特征的文件及其子文件
find . -name 'index.html*' -type f -print -exec rm -rf {} \;
' . ' 从当前目录及改目录下所有子目录; ' -type f ' 搜索文件类型为文件;如-type -d 表示目录类型; ' -print ' 将搜索结果输出到当前终端; ' -exec ' 执行后面所跟命令或文件脚本; ' {} ;\ ' 固定写法,一对大括号+空格
- rm 集成删除空目录
find . -type d -empty -delete