linux 命令 2.0

   

  • 看编译器:strings -a libaiDetect.so | grep -i gcc
  • 看依赖:readelf -d libaiDetect.so | grep NEEDED
  • 看 rss (程序运行rss) :   cat /proc/1980/status | grep -E "VmRSS|VmSize|VmData"
  • 过滤内核日志带时间戳的 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
    • 示例
      find ~/work/sdk/1-hi_ss927/SS928V100_SDK_V2.0.2.2/smp/a55_linux/mpp/out/lib/ -name *.a -exec nm -gA {} + | grep ss_mpi_isp_get_clut_coeff
      
      
      动态库:
        -Wl,--whole-archive -lss_isp -Wl,--no-whole-archive
        objdump -T lib/libgsfav.so | grep ss_mpi_isp_get_clut_coeff
  • 查找包含 1.8.3 但不包含 ?v=1.8.3 的: grep -inr '1.8.3' . | grep -v '?v=1.8.3'
posted @ 2025-06-30 14:54  封兴旺  阅读(38)  评论(0)    收藏  举报

联系方式: 18274305123(微信同号)