Solved How to fetch archive and extract it to a directory

I'm struggling to find the correct command to retrieve a compressed tar archive and extract it to a directory.
Can someone point out the error of my ways?

This is what I have:-

Code:
fetch  -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/kernel.txz | tar xf - -C workdir

which is supposed to fetch kernel.txz and extract it to workdir, but it doesn't work :-(...
 
Code:
curl "http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.1-RELEASE/kernel.txz"  -o kernel.txz
xz -d kernel.txz
tar xfv kernel.tar

Or:
Code:
wget "http://ftp.freebsd.org/pub/FreeBSD/releases/amd64/13.1-RELEASE/kernel.txz"
tar xvfz kernel.txz
 
I'm struggling to find the correct command to retrieve a compressed tar archive and extract it to a directory.
Can someone point out the error of my ways?

This is what I have:-

Code:
fetch  -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/kernel.txz | tar xf - -C workdir

which is supposed to fetch kernel.txz and extract it to workdir, but it doesn't work :-(...
Try
Code:
fetch  -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/kernel.txz | tar xzf - -C workdir

Note the z option to tar(1). It's needed to uncompress the archive. The directory workdir must exist in the current working directory.
 
Try
Code:
fetch  -o - ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/kernel.txz | tar xzf - -C workdir

Note the z option to tar(1). It's needed to uncompress the archive. The directory workdir must exist in the current working directory.
Actually, I'm not sure what I tried before, but I just entered the command I quoted (without the 'z' in tar xzf) and it worked so I'm puzzled as to why it did work without the z.
 
it autodetects compression

$tar czf - /bin/ls|tar tf -
tar: Removing leading '/' from member names
bin/ls
 
I'd say, just do this:
Code:
% fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/12.3-RELEASE/kernel.txz
# tar -xf kernel.txz
My reasoning is: Keep it simple, rather than get fancy with pipes and options. Keeping things simple also really helps if things go wrong. Considering that it does look like OP wants to install a kernel, reading the Handbook and manpages for the freebsd-update(8) can make things easier...
 
Did workdir exist the first time around? If not, it wouldn't work.

Also, posting the error messages you receive as opposed to "it doesn't work" helps us help you 👍
 
Back
Top