Skip to content

常用命令 ​


更新于 2023-11-24

ar ​

创建修改或扩展归档文件

strings ​

打印文件里的字符串信息

strip ​

去掉符号信息

nm ​

列出符号信息

size ​

列出目标文件里每个段的大小和总数

shell
size a.out

readelf ​

显示ELF文件信息

shell
# 显示帮助信息
readelf -h
#显示elf文件信息
readelf -a a.out
#显示elf文件头
readelf -h a.out
# 显示程序头信息
readelf -l a.out
# 显示区域头信息
readelf -S a.out
# 显示符号信息
readelf -s a.out
# 查询依赖动态库
readelf -d a.out | grep 'NEEDED'

objdump ​

显示目标文件信息

shell
# 反汇编可执行文件
objdump -d a.out

objcopy ​

ldd ​

打印依赖的共享库

shell
ldd a.out