Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello
Im trying to tar a some stuff in a other folder with this command
tar czvf test.tat.gz /home/apa/test/ (just a test)
But when i extract it later i get the hole /home/apa/test/ structure, is there anyway of tar just the files?
Have a look at the man page for tar. The -C option changes to the directory and tars them. Don't forget to terminate your command with a . (dot). Or do it manually, that is, change to the directory and just tar the files.
Sorry if I was unclear, after re-reading my post I understand it must be confusing. I refer to the dot when using the command from within the directory, meaning first cd into the directory you want to include files from and then run tar like this:
what i want is to be able to be in one directory (say /home/apa) and create a tar archive from there that, and when you untar in you get
1/hejsan.txt
or
2/hejsan.txt
You'll get a tarfile with the subdirectories and files included. If you move for example that tar file to your home directory and untar it there with:
Code:
tar xvf filename.tar
it will create the subdirectories you tarred in your home directory and the files in them. You can add the z option to compress. Have a look at the man page for tar:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.