Search the web
Sign In
New User? Sign Up
lucknow-lug · Uttar Pradesh Linux Users Group
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
decompress data removing leading dir from a *tar.bz2 file.   Message List  
Reply | Forward Message #184 of 247 |

Removing leading directory from tar.bz2 archive.

Suppose you have a directory named 'test' containing another directory
'openldap-2.3.27'
and.

[root@localhost ~]# cp -r /usr/share/doc/openldap-2.3.27/ test

Changed user permissions, (to demonstrate file permissions are not changed)
[root@localhost ~]# chown -R rakesh.rakesh test -v

Created a tar.bz2 compressed file.
[root@localhost ~]# tar cjvpf test1.tar.bz2 test

Uncompressing with available parameters of tar command.

[root@localhost ~]#tar xjvp --stripe-components 1 -f test1.tar.bz2 -C /tmp/

Here --stripe-components 1 will cause to filter out first leading directory, in
our case
'test' directory. -C parameter is used to define destination directory and 'p'
parameter
causes to preserve file permissions.

[root@localhost ~]# ls -l /tmp
total 32
drwx------ 2 root root 16384 Jan 6 2008 lost+found
srwxrwxr-x 1 anuj anuj 0 Jan 6 2008 mapping-anuj
srwxr-xr-x 1 root root 0 Jan 1 17:24 mapping-root
drwxr-xr-x 2 rakesh rakesh 4096 Jan 4 09:39 openldap-2.3.27

Leading 'test' directory is stripped out, user permissions are unchanged after
decompression of test1.tar.bz2 file

Anuj.




Wed Feb 20, 2008 7:54 pm

anujsingh_1
Offline Offline

Forward
Message #184 of 247 |
Expand Messages Author Sort by Date

Removing leading directory from tar.bz2 archive. Suppose you have a directory named 'test' containing another directory 'openldap-2.3.27' and. [root@localhost...
anujsingh_1
Offline
Feb 20, 2008
7:55 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help