On Unix-like operating systems, the strip command discards symbols from compiled object files.

This page describes the Linux version of strip.

Description

strip is a GNU utility to “strip” symbols from object files. This is useful for minimizing their file size, streamlining them for distribution. It can also be useful for making it more difficult to reverse-engineer the compiled code.

  • Description
  • Syntax
  • Examples
  • Linux commands help

The list of object files provided to strip may include archives and at least one object file must be provided. The object files themselves are modified by strip; new files are not created.

Syntax

strip [options] objfile […]

Options

Examples

strip -s a.out

The above example would strip the symbol table from the executable file a.out.

  • Link the executable as normal. Assuming that it is called foo then…Run objcopy –only-keep-debug foo foo.dbg to create a file containing the debugging info.Run objcopy –strip-debug foo to create a stripped executable.Run objcopy –add-gnu-debuglink=foo.dbg foo to add a link to the debugging info into the stripped executable.

  • Link the executable as normal.Copy foo to foo.fullRun strip –strip-debug fooRun objcopy –add-gnu-debuglink=foo.full foo