Monday, June 18, 2012

tar strip first directory

Thanks to http://www.marksanborn.net/linux/extract-without-first-directory) I have learned a new option to the venerable tar command.

I needed to extract the latest 1.x branch of the cakephp source code(1.3.15), but omit the initial  cakephp-cakephp-5e063d7. The --strip-components=1 option came in handy for this.

tar --strip-components=1 cakephp-1.3.15.tar.gz

:)