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!
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.
I am a bit ashamed to ask such a question after five years I switched to linux, but I remained globally hostile to command line mode unless I couldn't avoid it...
And here, I need to have a command line function work, and I don't manage to have a parameter understood.
I will be grateful if you help
The command is very simple, it's tar. I can log into my server's storage with ssh and then backup everything, file permissions and all, it's the best for a backup. But I don't manage to exclude a precise folder
Quote:
tar -cvf bak20071024.tar *
This one works. But I don't find how I can have a correct syntax to exclude a folder called "test"
That should work. I would keep an eye on it or perhaps redirect the output to a file so you can take a look at the contents to make sure you are not missing anything important.
You are probably backing up a live system. The file may have been removed before it could be backed up, or you tried to follow a dead link. Or you could have a correct directory (a file from the kernels point of view).
I don't know which directories you are trying to backup. Backing up the root directory without excluding /tmp, /dev, /tmp and other directories may not be the best idea.
I'm not certain, but if you use the -g <snapshot-file> option when creating an archive, it may ignore files that were altered after the start of the tar job. See section 5.2 of the info manual for examples of using snapshot files and incremental backups.
As for me, this is indeed to save the files from a live server (in mutualized [or should I say "shared", in english ?] hosting, so fortunately there is no filesystem to save, it's only that it's possible that cache, cookies and session files might differ from the beginning to the end of the archiving.
I'm saving everything in www/*
I made tests, and the bug only occurs when i try to exlude things from the archiving, I simply gave up on the exclusion.
However, I just only saw that tar -cvf bak.tar * does NOT save .htaccess files for me o.O
Would you guys imagine why ?
The options for the tar never spoke about ignoring or not ignoring hidden files... I am troubled...
This will tar all files starting with current directory (including hidden files) excluding any files or folders called "test"
This will error on testing.tar as this is the backup file and would be created in the directory that it is backing up, however it will do everything else that you requested.
How about
find . -print | grep -v ^\./test | xargs tar -cvf bak.tar
This causes duplicates because it is passing the directories as well as the contents of the directories.
You could use the '-type d' option to just pass directories but then you would still have subdirectories being passed (hence duplicates), the best that you could do is have it find only files '-type f', but not sure how this would handle named pipes and symbolic links.
Also, why bother? seems an extreeme measure to pass info into tar in this way.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.