惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy International News Feed
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
Troy Hunt's Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
V2EX - 技术
V2EX - 技术
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
O
OpenAI News
Cloudbric
Cloudbric
Google Online Security Blog
Google Online Security Blog
Schneier on Security
Schneier on Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Help Net Security
Help Net Security
Cyberwarzone
Cyberwarzone
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
NISL@THU
NISL@THU
N
News and Events Feed by Topic
T
Tenable Blog
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
月光博客
月光博客
酷 壳 – CoolShell
酷 壳 – CoolShell
美团技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog
V
Visual Studio Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 三生石上(FineUI控件)
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Jina AI
Jina AI
雷峰网
雷峰网
T
The Blog of Author Tim Ferriss
Hugging Face - Blog
Hugging Face - Blog
腾讯CDC
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东

博客园 - 松山居士

部署Hermes-Agent和SenseNova-Skills ubuntu用root账户启动服务指定脚本 WSL迁移OpenEuler虚拟机 采用Ollama本地布署DeepSeekCoderV2 Loongnix Server 23.2安装Docker及常用镜像 Ollama导出和导入DeepSeek预训练大模型 Win10上模拟LoongArch虚拟机安装Deepin系统 查看exe启动命令和参数 Visual Studio C++设置EXE和DLL在不同路径 JMeter做WEB和API自动化测试 PG数据库常用DDL VSCode+XMake开发环境搭建备忘 C++库管理Conan使用备忘 Python多版本管理Anaconda备忘 Win10上模拟LoongArch虚拟机并搭建Qt5开发环境 解决向日葵无人值守自启动的权限问题 强制去掉Qt的运行环境信息 QGIS插件开发备忘 WIN10配置FX DocuCentre-IV C2260 PCL6打印机 VMWare虚拟磁盘整理与收缩 解决启用C++17后byte重定义的问题(byte ambiguous ) 解决Deepin安装Flatpak程序时不能创建临时文件的错误
Linux shell 实用命令备忘
松山居士 · 2022-08-18 · via 博客园 - 松山居士

1、查询删除带有空格的文件

find ./ -name *.txt -print0 | xargs -0 rm

2、替换查找到文件中的指定字符

find . -name "*.sh" |xargs sed -i "s/192.168.10.24/192.168.94.135/g";

3、按当前环境仅下载RPM软件

yum install xxx --downloadonly --downloaddir=.

4、查看程序的动态链接库

ldd xxx
readelf -d xxx | grep NEEDED #可查看交叉编译的app或lib

5、让linux程序优先加载当前目录动态库

修改 /etc/profile 在文件末尾加上:
export LD_LIBRARY_PATH=./:/lib:/lib64:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH 

在Bash中临时改变:
export LD_LIBRARY_PATH=./:/lib:/lib64:/usr/lib:/usr/lib64:$LD_LIBRARY_PATH
echo $LD_LIBRARY_PATH

6、测试硬盘读写效率

dd if=/path/input_file of=/path/output_file bs=block_size count=number_of_blocks oflag=direct

#oflag/iflag=direct  不使用内存缓存
#bs=block_size  设置拷贝块的大小,常规有4k和1024k的两项指标

eg.
(1)写入速度:time dd if=/dev/zero of=/home/test.tar bs=4k count=500k oflag=direct
(2)读取速度:time dd if=/home/test.tar of=/dev/null bs=4k count=500k iflag=direct
(3)读写速度:time dd if=/home/test.tar of=/home/test1.tar bs=4k count=500k oflag=direct

 7、创建补丁和应用补丁

diff -Naur src src1 > xxx.patch     #生成差异patch
sed -i "s/src1/src/g" xxx.patch     #替换src1为src
patch -Np1 -i xxx.patch             #应用patch

cat xxx.patch >> pkg.patch          #合并patch

 8、flatpak下载离线包(测试无效)

flatpak build-bundle --runtime /var/lib/flatpak/repo mykde.flatpak org.kde.Platform 5.15-22.08
flatpak build-bundle /var/lib/flatpak/repo mygis.flatpak org.qgis.qgis stable

 9、切换N卡

 10、iso文件dd处理

lsblk    # 查看U盘的盘符
# 将iso文件复制到U盘 (可制作操作系统启动盘)
dd if=xxx.iso of=/dev/sdx  bs=1M status=progress oflag=direct
# 将光盘的内容制作成iso文件
dd if=/dev/sr0 of=xxx.iso  bs=1M status=progress oflag=direct

 11、deepin安装本地apk。在打开应用列表后,就可以找到设置,设置→ 安全→设定未知来源为启用状态。

uengine install --apk=/home/user/Downloads/baomiguan.apk                  #安装
uengine launch --package=org.anbox.appmgr --component=org.anbox.appmgr.AppViewActivity #列表

 12、将当前用户添加到docker用户组

sudo usermod -aG docker $(whoami)

 13、XFS磁盘碎片整理

xfs_db -c frag -r /dev/sdb1                 #查看碎片率
xfs_fsr /dev/sdb1                           #进行碎片整理

 14、网站压力测试

# -c 并发用户数; -t 测试时长
siege -c 300 -t 1M http://ip:port/xxx
# 以下为测试结果:
"transactions":                        719,                  #处理事务总次数
"availability":                        100.00,               #处理事务成功率
"elapsed_time":                        59.03,                #测试用时
"data_transferred":                    460.51,               #传输的总数据量
"response_time":                       13.53,                #等待响应的耗时
"transaction_rate":                    12.18,                #平均每秒处理请求的数量
"throughput":                          7.80,                 #平均每秒传输的数据量
"concurrency":                         164.81,               #最高并发数量
"successful_transactions":             719,                  #请求成功的数量                    
"failed_transactions":                 0,                    #请求失败的数量
"longest_transaction":                 55.63,                #响应单个事务最长耗时
"shortest_transaction":                0.04                  #响应单个事务最短耗时

 15、查看操作系统信息

 16、利用随机数写磁盘 (防止文件恢复)

dd if=/dev/urandom of=/dev/sda

 17、clamav更新病毒库并扫描全盘

freshclam & clamscan -r --bell -i /        #查扫子文件夹,病毒提示音,输出感染文件

 18、查看网络连接

 19、测试代理是否可用

curl -x http://proxy_ip:port http://www.baidu.com

 20、发送Post请求

curl -X POST -d  "user=test&pwd=123456" http://example.com/login

  21、查看显卡使用情况

 22、测试DNS服务

nslookup google.com 101.198.198.198

 23、Linux中python虚拟环境管理

python -m venv  myvenv                           #创建一个名为myvenv的虚拟环境

find / -name "pyvenv.cfg" 2>/dev/null           #查找已创建的虚拟环境

source /xxx/xxx/myvenv/bin/activate              #激活myvenv环境,xx是查找出来的路径

deactivate                                       #取消激活当前环境

pip install xxpackage                            #激活后安装程序包,不同环境不会互相干扰

 24、Docker打包镜像

#在容器中操作
apt clean  
rm -rf ~/.cache/* /tmp/* /var/tmp/*

#在主机中操作
sudo docker commit -a "AIR" -m "$(date +%Y-%m-%d)" ubuntuos cqism_ubuntu:convlib_v22
sudo docker save cqism_ubuntu:convlib_v22 -o cqism_ubuntu_v22.tar

 25、查看Ubuntu中已安装的JDK包名

apt list --installed | grep -E 'jdk|openjdk'