Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the tar -xvf command and it is taking the explicit path. However, the path is full.

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?

share|improve this question

migrated from serverfault.com Jul 10 '11 at 23:54

This question came from our site for system and network administrators.

You should clearly elaborate on what exactly is going on, as your current way of asking the question makes even the most sophisticated crystal ball seem slightly hazy. – towo Jul 14 '09 at 11:52

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.

share|improve this answer

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.

share|improve this answer

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).

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.