linux

Tar/Gzip Directory without Preserving Directory Heirarchy/Structure

I just wanted to post this code snippet up here in case anyone else is stuck Googling for many hours without success how to do this...

I have a PHP script (actually, a Drupal module I'm working on) set up to grab a folder, archive it using tar with the -z (gzip/compress) option, and post a link to the archive. However, since I was using PHP, I couldn't do what I normally do when tar-ing a folder, that is, I couldn't change directory (cd) first, then create the archive.

The problem this creates (for me) is that, upon expanding the PHP-created tar.gz archive, the system folder/directory heirarchy is expanded as well... so my files are buried in a folder 5-10 levels deep. Not ideal for zipping up a bunch of photos or something.

So, to overcome this problem, you can use tar's -C option, which allows you to change directory before tar-ing the files:

tar -C /directory/of/files-to-archive -zcvf /path/to/final-archive.tar.gz .

This simply creates an archive that expands to a folder with the archive's name, and has all the files contained directly inside!

My final command in the PHP script used the exec() function, which allows command-line commands from a PHP script.

Debian With a Refreshing Minty Flavor

Linux Journal is reporting that a new edition of Linux Mint has been released: Linux Mint Debian Edition (LMDE). Mint has been around since 2006 as a flavor of Ubuntu Linux and its current release is version 9, called Isadora.

The new Debian Edition - based on Debian Testing - will, as one would expect, differ from the standard Mint to which Ubuntu differs from Debian Testing. But there will also be a lot of similarities, such as robust package repositories, since Ubuntu is based on Debian in the first place.

Debian is a distro which is known for stability and extensive testing. If code makes it into Debian, it has probably been vetted quite thoroughly. Debian Testing, the current development release, is not as rock steady and I am uncertain of how its stability compares. One review I looked at indicated that at least the LMDE version seemed relatively trouble free. That is an encouraging sign.

Ubuntu has been more on the bleeding edge than Debian and has more of the latest thing in Linux, for better or for worse. So moving away from Ubuntu towards Debian, even Debian Testing, will be an interesting change for adventerous Mint users.

A major difference between Mint and LMDE, is how releases are handled. Ubuntu, and therefore Mint, follows a pretty rigorous schedule for new releases and each new release is offered as a single, big upgrade. By contrast, LMDE has a "rolling release" system. In other words, LMDE is upgraded through many small updates throughout its life rather than large version changes. I could definitely see how some people could prefer the rolling system. It seems like it would cause less disruption to availability.

I have been a Mint user for awhile now, running it quite happily on my Sony laptop. It has shown itself to have all of the best parts of Ubuntu while having some nice attributes of its own. Other than the problem which I had when upgrading to Isadora from Helena (8) in which it broke my graphics driver and forced me to do a reinstall, I have no complaints about it and want to go on using it. LMDE looks like something I would like to try, especially as I have long been interested in seeing what Debian was like. And Debian with a refreshing minty flavor sounds like good times.

 

Edit note: This article needed a few edits as I had a few misunderstandings about the LMDE and Debian Testing. I guess life is about learning. It should be correct now :D

Linux Contractor Fired for Using Firefox/Linux...

This is a complicated story but one that must be told. I'm not sure there is anything that can be done about it except rage at the moon...

But it needs to be told none the less.

Did I mention it gets complicated? It does, but it does so for a reason. Let's introduce the starting lineup.
 

The Players:

*Our Principal - In the US.

*An Indian Contracting Company

*A large computer/server company with three letters in their name.

*A large credit card company with four letters in their name.

*A friend of The Principal

The Principal is a guy who works with Linux Servers for a living. He was contacted by the Indian Contracting Company and asked to apply for a project position through the large company with three letters in their name. The contract was to patch the 1000+ linux servers with some proprietary SAN access software

With me so far?

http://linuxlock.blogspot.com/2009/11/linux-contractor-fired-for-using.html

Syndicate content