UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 24.13 Save Space in Executable Files with strip Chapter 24
Other Ways to Get Disk Space
Next: 24.15 Trimming a Directory
 

24.14 Don't Use strip Carelessly

One nice way to save space in your filesystem is by running strip (24.13) on directly-executable (binary) files. You'll probably think of running it recursively with find (17.2). Be careful. On some operating systems, using strip on a setuid file (1.23) will strip the setuid bit; the program won't be setuid anymore. It's best to tell find to skip setuid and setgid files. For instance, the command below finds all world-executable files (17.15) that are not setuid or setgid (17.16):

% find . -type f -perm -0001 ! -perm -4000 ! -perm -2000 ...

Other files that shouldn't be stripped include the UNIX kernel (like /vmunix) and files that programmers need to debug.

- JP


Previous: 24.13 Save Space in Executable Files with strip UNIX Power ToolsNext: 24.15 Trimming a Directory
24.13 Save Space in Executable Files with strip Book Index24.15 Trimming a Directory

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System