Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - News > Syndicated Linux News
User Name
Syndicated Linux News This forum is for the discussion of Syndicated Linux News stories.


  Search this Thread
Old 07-30-2013, 12:30 PM   #1
LXer NewsBot
Registered: Dec 2005
Posts: 109,143

Rep: Reputation: 117Reputation: 117
LXer: How to create a self-extracting archive or installer in Linux

Published at LXer:

While a typical archive file relies on a separate program (e.g., tar, gunzip) to extract content from the archive file, a self-extracting (SFX) archive/installer is an executable itself, and can self-extract its content simply upon running. This tutorial describes how to create an SFX archive or installer in Linux

Old 08-29-2013, 04:49 PM   #2
Senior Member
Registered: Jan 2011
Location: Oslo, Norway
Distribution: Slackware
Posts: 2,514

Rep: Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644Reputation: 1644
It is easy to make a self extracting archive on Linux. No need for sharutils or makeself. Just add the following 39 characters onto the front of an XZ compressed tar archive, then you can make it executable and run it to extract (you need only change 'J' to 'z' or 'j' if you want to use a gzip or bzip2 compressed archive).

tail -n+4 "$0" | tar Jx
Note: Make sure there aren't more than 3 lines in sfx-stub (e.g. too many line feeds at the end), otherwise it won't work. You can double check this with "wc -l sfx-stub", before you add the file to the front of your archive.

To add this to the front of an archive, save the above in a text file called 'sfx-stub' and then use cat like so:

cat sfx-stub example.tar.xz >
Of course one could argue that self extracting archives are pointless on *nix systems anyway given that tar is always present, plus the need to make the file executable first, limiting the convenience aspect.

Last edited by ruario; 08-30-2013 at 12:40 AM. Reason: Clarified the text, changed to count line number rather than character number


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Extracting an SGI IRIX cpio archive on Linux (also Cray and SCO) ruario Other *NIX 1 01-08-2013 12:47 AM
Creating encrypted self-extracting archive in Linux fadetobright Linux - Newbie 5 04-27-2009 08:59 PM
Extracting archive file to /opt? DaftDave Programming 14 04-01-2008 06:46 AM
LXer: Self-extracting Archive HOWTO LXer Syndicated Linux News 0 04-20-2007 05:01 PM
Extracting files from .bin archive Sir Loin Linux - Software 5 03-25-2007 08:12 PM > Forums > Linux Forums > Linux - News > Syndicated Linux News

All times are GMT -5. The time now is 07:43 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration