10 Linux Strip Command Examples (Reduce Executable/Binary File Size)

Strip command is used mostly in situations where you want to produce a production quality object file which contains minimum required information so that it can be light weight. You can also use it if you don’t want your executable or object file to get reverse engineered.

In this article, we will understand the usage of this command through some practical examples.
The syntax of strip command is :

strip [options] objfile...

Examples

Before jumping on to the examples, here is the code behind the executable that we would be using in this article.

So the absence of example.c symbol in the above output confirms that it was stripped off.

7. Create a new stripped off file using -o option

By default the strip command replaces the existing executable or object file with the stripped off version of the same. But, in case there is a requirement that the stripped file should not replace the original one then that can be done by supplying the name of the new file along with the -o option.

About The Geek Stuff

My name is Ramesh Natarajan. I will be posting instruction guides, how-to, troubleshooting tips and tricks on Linux, database, hardware, security and web. My focus is to write articles that will either teach you or help you resolve a problem. Read more about Ramesh Natarajan and the blog.