分类目录归档:Linux

sed

sed 是一种流编辑器,用于对输入流(文件或管道)进行基本的文本转换。它是 Unix/Linux 系统下的一个非常强大的文本处理工具。以下是 sed 的一些常见用法:

  • 替换文本
  sed 's/旧字符串/新字符串/' 文件名

这会将文件中的第一个匹配到的“旧字符串”替换为“新字符串”。

  • 替换所有匹配项
  sed 's/旧字符串/新字符串/g' 文件名

这会将文件中所有匹配到的“旧字符串”替换为“新字符串”。

  • 在特定行替换
  sed '2s/旧字符串/新字符串/' 文件名

这只会替换第 2 行中的第一个匹配项。

  • 删除行
  sed '2d' 文件名

这会删除第 2 行。

  • 打印特定行
  sed -n '2p' 文件名

这只会打印第 2 行。

  • 保存更改到文件
  sed -i 's/旧字符串/新字符串/g' 文件名

这会直接修改原文件内容。

如果你有具体的 sed 使用场景或问题,请提供更多信息,我可以给出更详细的帮助。

Linux swap使用率为0

Linux 中 Swap 交换分区设置教程,以及 Swap 大小与内存的关系 – 知乎

系统配置:Linux有一个swappiness参数,决定了系统使用swap的频率。默认值通常为60,值越低,越不容易使用swap。可以通过以下命令查看当前值:

cat /proc/sys/vm/swappiness

如果你希望系统更倾向于使用swap,可以将其设置为一个更高的值,例如:

sudo sysctl vm.swappiness=80
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/sunyuhua_keyboard/article/details/14248714

nginx restart failed:nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1 ) 解决办法

nginx restart failed:
nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1 )

解决办法:

nginx restart failed:
nginx: [alert] OPENSSL_init_ssl() failed (SSL: error:12800067:DSO support routines::could not load the shared library:filename(/snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so): /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/fips.so: cannot open shared object file: No such file or directory error:12800067:DSO support routines::could not load the shared library error:07880025:common libcrypto routines::reason(37):name=fips error:0700006D:configuration file routines::module initialization error:module=providers, value=provider_sect retcode=-1      )

Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /var/log/letsencrypt/letsencrypt.log or re-run Certbot with -v for more details.
[root@ooops ~]# find / -name fips.so
/usr/lib64/ossl-modules/fips.so
[root@ooops ~]# mount --bind /usr/lib64/ossl-modules/ /snap/certbot/4325/usr/lib/x86_64-linux-gnu/ossl-modules/

4325注意替换为你的id

ln -s 两次无限递归问题:给目录创建两次软链接会出现无限递归

例如:

ln -s /var/www/php/ /mnt/www/blog
# 第一次会创建出“/mnt/www/blog -> /var/www/php/” 这个软链接
ln -s /var/www/php/ /mnt/www/blog
# 第二次会创建出“/var/www/php/php -> /var/www/php/” 这个软链接
# 第三次会提示 File exists

解决办法:(创建前判断下目标是否存在即可)

[ ! -e /mnt/www/blog ] && ln -s /var/www/php /mnt/www/blog