Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
[ricardo@localhost ~]$ tar --gzip --create --verbose --file=/home/ricardo/tmp/xxx.tar.gz /home/ricardo/testesfpc/teste.pas /home/ricardo/testesfpc/h.pas --recursion
tar: Removing leading `/' from member names
tar: --recursion: It is not possible stat: File or directory not found
tar: Saída por erro atrasada pelos erros anteriores
Why I receive an error in the --recursion?
I guarantee that there are sub directories in the /home/ricardo/testesfpc.
I try to put --recursion before the --file parameter. The error disappear but no recursion takes place
All files and directories of testesfpc has read permission in the three diectory levels...
The GNU manual says that --recursion is the default but the recursion never occurs.
First of all tar does recurse through files and directories as the default. This command should work:
tar --gzip --create --verbose --file=/home/ricardo/tmp/xxx.tar.gz /home/ricardo/testesfpc/teste.pas /home/ricardo/testesfpc/h.pas
Remove the --recurse from after the files names. Tar is treating "--recurse" as a file name and cannot find it. Are the names you specified (/home/ricardo/testesfpc/teste.pas /home/ricardo/testesfpc/h.pas) directories or files?
If they are:
* the 2 files will placed into the archive.
* directories it will put all files and sub-directories into the archive
Honestly, I use Bzip2 just because "j" is easier for me to hit than "z". >_>
What I would do(Maybe not the best, but oh well) is make a new directoy in your HOME, and copy all the stuff you want tarred into it. Then, tar that folder.
When it comes time to untar it,
tar -xvzf FILE.tar.gz -C /path/to/target/dir
Replace "z" with "j" if you tarred it with "j". "-C" says "I want all files and folders in the tar file to be unzipped to /path/to/target/dir"
In each of your tar commands you are only giving tar a file name(tar_help.txt) not a directory (/home/ricardo/doc). Tar copies every file or directory you specify on the command line. If you give tar a directory name it will tar that directory and everything inside it which in your case includes tar_help.txt:
tar --gzip --create --verbose --file /home/ricardo/tmp/xxx.tar.gz /home/ricardo/doc
This command will tar the directory /home/ricardo/doc and all the files in it which includes tar_help.txt.
Bzip2 is a different algorithm and is better for large tar files because it compresses things smaller than gzip can. If you ever check out the kernel sources at www.kernel.org, you'll see that the sources come as gz or bz2 tar files. It's the exact same tree but the bz2 files are like 10MB smaller.
That is going to put the whole directory structure starting at /home/user/docs into a tar file. That means that everything in docs, all the folders in docs, and all the files in those folders are all included. JohnDoe and others have already posted to this effect.
I guess you can just start out by going to /home/user and just tar czvf docs.tar.gz docs/ it does the same thing.
I think you may be looking too much into this one. If you aren't getting errors than it should be working fine. I'm getting confused.
One last try using the example directory listing you gave.
[ricardo@localhost doc]$ ls -al
drwxrwxr-x 4 ricardo ricardo 4096 Dez 20 10:36 .
drwx------ 34 ricardo ricardo 4096 Dez 20 10:33 ..
drwxrwxr-x 2 ricardo ricardo 4096 Ago 4 18:39 DocumentaçãoFreePascalLazarus
-rw-rw-r-- 1 ricardo ricardo 17793 Ago 30 09:28 fast_guide_to_linux.odt
drwxrwxr-x 2 ricardo ricardo 4096 Dez 18 15:14 Manual_do_Tarball
-rw-rw-r-- 1 ricardo ricardo 9238 Nov 30 15:42 tar_help.txt
[ricardo@localhost doc]$ tar --gzip --create --verbose --file /home/ricardo/tmp/xxx.tar.gz tar_help.txt
[ricardo@localhost doc]$ tar -ztf /home/ricardo/tmp/xxx.tar.gz
If you want to tar one file and a directory and all its contents here is what you would type:
tar --gzip --create --verbose --file /home/ricardo/tmp/xxx.tar.gz /home/ricardo/doc/DocumentaçãoFreePascalLazarus tar_help.txt
(The tar command including the directory and file name is all on one line even though you may see is as two lines in this message)
This command will tar the directory /home/ricardo/doc/DocumentaçãoFreePascalLazarus and all the files in it and also tar the one file tar_help.txt. I you specified other files or directory names on the tar command line it will put all the specified files and directories into the tar file.