I am using the tar -xvf command and it is taking the explicit path. However, the path is full.
Example:
tar -xvf 13.2.tar
It is taking the path of /mnt folder. The / folder is full.
How can I tar the file with the implicit path?
I am using the tar -xvf command and it is taking the explicit path. However, the path is full.
Example:
tar -xvf 13.2.tar
It is taking the path of /mnt folder. The / folder is full.
How can I tar the file with the implicit path?
The difference between using canonical (aka explicit) and relative (what you're probably calling implicit) is whether you use a / at the beginning.
For example, if the current working directory is /usr/home/bob, the following commands have exactly the same effect
tar -xvf foo.tar * tar -xvf ./foo.tar * tar -xvf ./foo.tar ./* tar -xvf /usr/home/bob/foo.tar * tar -xvf /usr/home/bob/foo.tar ./* tar -xvf /usr/home/bob/foo.tar /usr/home/bob/*
But I suspect that this isn't really your question. It seems more like you need to determine the disk usage, and locate a directory that's not full. This can be done with the df command.
df -k # space on disk in kilobytes
df -m # as above, but in meg
df -g # as above, but in gig
And you can use mount to show you what file systems are mounted at what devices.
Usually tar needs the --absolute-names or --absolute-paths option to retain the root '/' part while creating an archive. Even if you force it in that way, the extract skips the leading '/' too.
However, if you have an archive with the leading '/' and you tar does not skip it while extracting, NoahD's answer should work in this form,
pax -r -s ',/mnt,/new/path,' -v -f 13.2.tar
I think pax does not handle compressed files, so you would need to pipe after decompress into pax.
That would go like this (assuming you have a gzipped archive)
gunzip -c 13.2.tar.gz | pax -r -s ',/mnt,/new/path,' -v
I found this wiki page on Google just now.
To create a tar file with a relative path,
cd /parent/of/dir/to/tar
tar cvf subdir.tar subdir
To unpack a tar into a specific directory other than the current working directory, use the -C (uppercase C) switch.
If you want to untar a file with absolute pathnames in it to a point other than root, you might need to mess about with chroot(1).
I believe pax will do the trick
pax -r -s,/mnt,/gooddir, -f 13.2.tar
It should let you substitute in a new root directory.