Linux Blog

Switch! The Linux Blog Dog

Filed under: The Linux Blog News — at 10:57 am on Friday, June 20, 2008

So, after a long time with no posts I think I figured out why I haven’t been writing as much. You see, I recently got a dog, she is a 7 month old border collie – whippet mix. Her name is switch and she currently demands a lot of attention or she gets into mischief, but after a long walk she does a really wicked FireFox impression which makes up for it.

I’ll be writing as much as I can, but again if any one would like to write on this blog or is interested in guest blogging just let me know.

Below are some pictures of Switch! The Linux Blog Dog

Linux Blog Dog
Linux Blog Dog

Tar Archive Mischief.

Filed under: Shell Script Sundays — at 1:22 am on Sunday, June 1, 2008

I ran into a problem the other day when I downloaded a particular tar.gz archive (Simple Machine Forums to be specific.) The problem was that despite how good SMF might be the developers did not put the files in a folder before they tar.gz’d it. This is not the only time I have ran into this problem, a lot of developers actually do it. Over time its become a habit to assume that its in a folder.

Here’s a solution to delete all files that were extracted from an archive:

tar xvzf [filename] > [filename]-filelist.txt
cat filelist.txt | while read i; do rm $i; done;

If you want to, you can do a dry run of the script by putting an echo in front of the rm statement and looking at the output. All files that you had e.g index.php will have most likely been overwritten from the extract in the first place so, it doesn’t hurt to delete them.

Once you have deleted all of the files from the archive you can simply create a directory and use the following to extract to it:

tar xvzf  [filename] -C [yourdir]