← 返回命令列表

Linux command

strip 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Strip

strip [path/to/file]

Example

strip [path/to/input] -o [path/to/output]

Example

strip -d [path/to/file.o]

Example

strip --strip-unneeded [path/to/file]

Keep

strip -K [symbol_name] [path/to/file]

Remove

strip -R [section_name] [path/to/file]

Example

strip --only-keep-debug [path/to/file]

说明

strip removes symbols and other data from object files and executables, reducing file size and making reverse engineering more difficult. It modifies files in-place by default. Archives (.a files) can also be stripped. Stripping debug symbols is common for release builds to reduce binary size while retaining functionality. The --only-keep-debug option creates separate debug files that can be used with debuggers while keeping production binaries small.

参数

-s, --strip-all
Remove all symbols
-g, -S, -d, --strip-debug
Remove debugging symbols only
--strip-unneeded
Remove unneeded symbols for relocation
--only-keep-debug
Keep only debugging sections
-K, --keep-symbol _name_
Preserve specific symbol (repeatable)
-N, --strip-symbol _name_
Remove specific symbol (repeatable)
-R, --remove-section _name_
Remove named section (wildcards allowed)
--keep-section _pattern_
Retain matching sections
-x, --discard-all
Remove all non-global symbols
-X, --discard-locals
Remove compiler-generated local symbols
-o _file_
Write output to file (single input only)
-p, --preserve-dates
Keep access/modification timestamps
-D, --enable-deterministic-archives
Use zero for UID/GID/timestamps in archives
--strip-dwo
Remove DWARF .dwo sections (split debug info)
--strip-section-headers
Strip ELF section headers (ELF files only)
--remove-relocations _pattern_
Remove relocation information from matching sections
--keep-file-symbols
Retain symbols identifying source file names
--keep-section-symbols
Retain symbols identifying section names
-M, --merge-notes
Merge and remove duplicate notes in ELF files
-w, --wildcard
Allow shell-style wildcards in symbol names for -K and -N
-v, --verbose
List all processed files
--help
Display help
--version
Display version

FAQ

What is the strip command used for?

strip removes symbols and other data from object files and executables, reducing file size and making reverse engineering more difficult. It modifies files in-place by default. Archives (.a files) can also be stripped. Stripping debug symbols is common for release builds to reduce binary size while retaining functionality. The --only-keep-debug option creates separate debug files that can be used with debuggers while keeping production binaries small.

How do I run a basic strip example?

Run `strip [path/to/file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s, --strip-all do in strip?

Remove all symbols