Today I wanted to create a tar file that excludes hidden files and folders — ones that start with a dot (i.e. ‘.’).
Like a good boy, I read the fine man page (RTFM — sometimes the F is replaced with a ruder word than “fine”) but I couldn’t get it to work after several different variations of the exclude pattern. It seems that the exclude pattern that tar expects doesn’t follow any of the regular expression (a.k.a. regex) syntaxes that I’m familiar with. Someone enlighten me here if you know what it expects.
Anyway, after lots of unsuccessful googling, I finally found a relevant post. Here’s an example of the magical incantation to do this trick (it seems to work in my brief testing using Ubuntu Linux):
tar -cf test.tar foo/ --exclude '.*'
If this tip helped you, please leave me a comment or send me an email!
If you are rolling your own backup shell script on your Ubuntu Linux box, chances are you might want to use
tar or perhaps
rsync somewhere in that script. For this example, let’s say you’ve chosen to use
At some point, you will probably want to use
cron or some other mechanism to automate your backup. Furthermore, if you want to coordinate the backup of several computers from one central computer, you will probably end up running the backup by making an
ssh connection from the central computer to each backup target computer. In that case, the user that is running the backup will probably not be
root (unless you allow root logins on your ssh servers) and may therefore have limited privileges.
If that’s the case, the user will not be able to backup some files with
tar unless you use
sudo tar. The problem with this is that
sudo will prompt you for a password. If you want to prevent this prompt so that you can totally automate the backup over ssh, you’ll need to do two things. …Continue reading » How to Use sudo tar in a Script Without Password Prompt
If you’re thinking about virtualizing your IT environment but you don’t necessarily have a lot of budget/money to do it with, here are a few tips that may help you on your way.
Most of us already know about VMware‘s offering of VMware Server for free. This, coupled with some great open-sourced operating systems can make for some pretty efficient hypervisors. …Continue reading » Installing VMware Server on Ubuntu 7.10
Recently, I’ve discovered a very neat tool for administering some of my linux servers. It is called webmin, and it may be one of the more complete web based system administration tools I have seen for linux. …Continue reading » Installing webmin on Ubuntu 7.10