archive

Those Mac .DS_Store files

Mac .DS_Store files FAQ: What are these .DS_Store files on my Mac, and how can I get rid of them?

Those crazy Mac .DS_Store files (also referred to as "dsstore" files) finally got to me, so I did some research on where they come from, and how to get rid of them (or more accurately, how you can't get rid of them).

Here's what I've learned about Mac OS X .DS_Store files.

A "tar extract multiple" tip - How to extract multiple files from a tar archive

tar extract FAQ: Can you demonstrate how to extract (un-tar) multiple files from a tar archive, without extracting all files from the archive?

Sure, here are a couple of examples of how to extract multiple files from a tar archive (un-tar them), without extracting all the files in the archive.

First, if you just need to extract a couple of files from a tar archive, you can usually extract them like this, listing the filenames after the tar archive:

How to un-tar one file from a tar archive

tar extract FAQ: How do I extract one file (or multiple files) from a tar archive without extracting the entire archive (i.e., how do I un-tar files from a tar archive)?

Git export: How to export a Git project

Git export FAQ: How do I export a Git project, like I would do with a "cvs export" or "svn export"?

There is no "git export" command, so instead you use the "git archive" command. By default, "git archive" produces its output in a tar format, so all you have to do is pipe that output into gzip or bzip2 or other.

Git export example

Here's a simple Git export command I just ran. I moved into the root of my Git project directory, then ran this command to create a new file named "latest.tgz":

tar gzip example - How to work with files that are tar'd and gzip'd

tar gzip FAQ: How do I work with tar archives that have been created with tar and gzip?

When you work on Unix, Linux, and Mac OS X systems, you'll quickly find that tools like tar and gzip are your good friends, so learning how to work with them is very important. Here's a quick look at how to work with the most common tar/gzip scenarios.

Linux tar command man page

The contents of this page come from the CentOS Linux tar man page, i.e., the man page for the Linux tar command (also known as the help page for the tar command).

Some Linux tar command examples

The Linux tar command is used to created and extract archives. An archive is one file that contains one or (usually) many other files. The name "tar" itself comes from the phrase "tape archive", but that's just an old name. I mostly just create archives and then send them over the wire these days.

Creating Unix/Linux tar archives

To create an archive of all files in your current directory, and all subdirectories, use this tar command:

Linux ‘tar’ command examples

Unix/Linux tar command FAQ: Can you share some Linux tar command examples?

Sure. I'm a big believer in learning Unix/Linux commands by seeing examples, and I know from experience it will really help to see some Linux tar command examples. But first, a brief bit of background information.

tar gzip example - how to extract a tar archive that has been gzip'd

tar gzip FAQ: Can you show how to extract (un-tar) a tar archive that has been created with tar and gzip?

Say you have a file (archive) named myfile.tar.gz, and you want to unzip it and unpack (un-tar) it in one command. This "tar extract" command should do the trick for you:

tar xzf myfile.tar.gz

That tar command can be read as "use tar and gzip (the 'z' option) to extract the contents of the file (archive) named myfile.tar.gz.

Linux backups: Using find, xargs, and tar to create a huge archive

I did something wrong in a previous blog entry that led me to use the "pax" command to create a large backup/archive. There's nothing wrong with using the pax command -- other than the fact that it's not available for Cygwin -- and I really needed to created a huge archive. (I know that pax is available for our Linux and Unix systems, but I can't find a version for Cygwin.)