linux 命令 2.0
- 过滤内核日志带时间戳的 OOM 记录:journalctl -k --since "24 hours ago" | grep -E "oom-killer|Out of memory"
- 组
- 查看:cat /etc/group
- 新建组:sudo groupadd fxws; sudo usermod -aG fxws fxw;sudo usermod -aG fxws root
- chown -R fxw:devshare /home/fxw/sdk/2-hi_ss927/AI/tools/2-atc
- 删除组:sudo groupdel fxws
- readelf:Linux 查看 ELF 可执行文件 / 动态库信息工具
- readelf -d ./main ; readelf -s ./main // -d 动态库
- 列出系统里所有被进程打开、正在使用的文件 / 设备: lsof
- 安装包大小: dpkg-query -W -f='${Installed-Size}\t${Package}\n' 'automake*' | awk '{sum+=$1} END {printf "Total Installed Size: %.2f MB\n", sum/1024}'
- 查看你环境变量里的系统库:ldconfig -p | grep libisl
- 查看库属于哪个编译器:
-
# readelf -p .comment libascendcl.so String dump of section '.comment': [ 0] GCC: (HC&C V1R3C00SPC200B042_20221123) 7.3.0 # aarch64-mix210-linux-gcc --version aarch64-mix210-linux-gcc (HC&C V1R3C00SPC200B042_20221123) 7.3.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
- 查看公网ip: curl ifconfig.me
- 驱动里面查找打印字符串:strings ot_mipi_rx.ko | grep "fxw"
- 查找关键字并替换: find . -type f -exec sed -i 's/aaa/bbb/g' {} +
- find . -name '*.mk' -type f -exec sed -i 's/aaa/bbb/g' {} +
- find . \( -name 'Makefile' -o -name '*.mk' \) -type f -exec sed -i 's/aaa/bbb/g' {} +
- 在库里面查找函数并输出库名:find out/lib/ -name *.so -exec nm -DA {} + | grep AAA // 静态库: -gA
- 查找包含 1.8.3 但不包含 ?v=1.8.3 的: grep -inr '1.8.3' . | grep -v '?v=1.8.3'
本文来自博客园,作者:封兴旺,转载请注明原文链接:https://www.cnblogs.com/fxw1/p/18957802

浙公网安备 33010602011771号