How To: Extract .tgz files with Tar

How To: Extract .tgz files with Tar

.tgz files have been used in Unix for years. Originally created to handle backups to tape, it’s now commonly used to archive groups of files together such as installers for software. This is where most people run across the confusing .tgz, tar.gz, or tar.bz2 file extensions.

These instructions should be universal for most Unix systems, Linux, BSD, OS X, and even Solaris. Please feel free to leave a comment if they’re not.

To get to tar’s help files, simply type: man tar

The output will look something like this:

TAR(1) tar TAR(1)

NAME
tar – The GNU version of the tar archiving utility

SYNOPSIS
tar [options]

Operations:
[-]A –catenate –concatenate
[-]c –create
[-]d –diff –compare
[-]r –append
[-]t –list
[-]u –update
[-]x –extract –get
–delete

Common Options:
-C, –directory DIR
-f, –file F
-j, –bzip2
-p, –preserve-permissions
-v, –verbose
-z, –gzip

So for extracting tar files, we will use the x and f options. Thus:

tar xf filename.tar

Will work fine. Note that the same command should usually work for any file that has the tgz, tar.gz, or tar.bz2 extensions too. The tar command should automatically detect the file type and call gzip or b2zip. If it doesn’t there are two more commands.

For .tgz or tar.gz files, add a z to the command: tar xzf filename.tgz

For .bz2 files, add a j : tar xjf filename.tar.bz2

At this point the file should unzip and untar into the same directory as the archive file. Sometimes an auto installer will come up, but that is still pretty rare.

How To: Check OS X Disk Usage

How To: Check OS X Disk Usage

In OS X there are two ways to do everything. Via the GUI, or Via the command line. Frequently the GUI method does fine for most uses. But sometimes a bit more information is needed.

In the GUI, getting Disc Usage is simple. Open Finder, click on the drive and look at the bottom of the finder window. The number of files selected and the space available is displayed. But, this only shows the current directory and includes ALL sub folders under it.

But with a little use of the command line we can get a lot more information. Opening terminal defaults to the active user’s home directory.

At this point type du -sh * We’re adding the s for “Display an entry for each specified file,” and h for “Human-readable” output.

This will give a readout like this:
28G Desktop
41G Documents
13G Downloads
3.9G Library
0B Movies
5.1G Music
42G Pictures
121M Public
374M Sites

As can be seen this then gives a readout of each directory in the current one and provides the total space it takes up. In cases of low hard drive space this gives a good way to quickly find folders that may be too big. It could also be run in the /Users folder on multi-user machines to find out who it using all the hard drive space.

How To: Clean “Your internet access is going to get suspended” Virus

How To: Clean “Your internet access is going to get suspended” Virus

I was recently sent a copy of the “Your internet access is going to get suspended” virus. Which is really annoying since my Bit Torrent and P2P use is limited to Magnatune and downloading ISOs of Linux/BSD systems.

So, seeing a lack of responses from the big companies on how to remove it, I sacrificed my one Windows machine to it in an attempt to figure out how to fix it. This is a down and dirty fix, but it worked.

Installing the Virus is easy, download the ZIP file, open it, then run the .EXE file inside.

The Virus installed a new winlogin.exe file. Unluckily this can’t just be removed. After pulling the network cable to keep the machine from reinfecting itself, boot into safe mode. At the command prompt, delete the Winlogin.exe file, along with krnlcab.sys, cabpck.dll, and k86.bin from the System folder.

At this point follow these directions to extract a new winlogin.exe from the original install CD. Remove tmp/msi_setup/* then reboot the computer and double check that the three files above are still gone, and the winlogin.exe has the new date.

Plugin the network cable and immediately do a software update. I found that SP3 had to be reinstalled, but it worked fine.

This is down and dirty, only worked on XP, and is potentially system breaking. If you are not confident in the directions above, wait for the Anti-Virus vendors to create an official fix.

How To: Edit MAC Address on Linux

How To: Edit MAC Address on Linux

Your network card in your linux box just got replaced. Or the onboard one on the mother board went bad and now you need to get it up. But Linux is not automatically recognizing the new card correctly.

Get to a terminal prompt. Type ifconfig to get the current mac address. Keep in mind that you may need to watch the boot up process to find out what your network card’s device name really is. It’s usually eth0, but em0 or even en0 are common. Also it may not be the first or ‘0’ device, so eth1 is entirely valid. Out put will look something like this:

eth0: flags=8863 mtu 1500
inet6 fe80::21f:5bff:fee8:b40d%en0 prefixlen 64 scopeid 0x4
inet 127.1.1.1 netmask 0xfffffc00 broadcast 127.1.1.255
ether 00:1f:5b:72:b4:aa
media: autoselect (1000baseT ) status: active
supported media: autoselect 10baseT/UTP 10baseT/UTP 10baseT/UTP 10baseT/UTP 100baseTX 100baseTX 100baseTX 100baseTX 1000baseT 1000baseT 1000baseT none

The MAC address is the 6 hexadecimal numbers on the line that says “ether” so 00:1f:5b:72:b4:aa is the MAC address. This number is also written on a sticker on almost every device with a network device these days. It’s even included on the outside box of many new computers as it’s a very distinctive number.

Next is to edit the file this info is kept in. Go to:

/etc/sysconfig/network-scripts/ifcfg-

Edit (or totally remove if you’re using DHCP boot) the MAC address line. Save the file and reboot!

How To: Create a Chart in Neo Office

How To: Create a Chart in Neo Office

NeoOffice is one of my most favorite free applications. Unluckily, like other Office programs it is starting to suffer from feature bloat. Apparently there are a million other things people want from a full fledged office program other then basic writing of documents.

One of these is apparently charts. Pie Charts, graphs, bar charts, etc. Anything to make a presentation look good and soften the blow of impending bankruptcy.

Step one is to create (or simply open) a spread sheet of the data to be displayed in Chart format.

Then click on the rows or columns that need to present in the chart.

At the top of the screen, choose insert then go down to Chart (near the bottom)

Double Check that the desired fields are listed in the range section. If either the Row or Columns is a label field, be sure to check the boxes on the left. Also put the chart on a different sheet (which is probably most desired,) by changing the “Chart Results in Worksheet” field. This will allow copy and pasting of the chart into another document, or even being linked to from a different document.

Hit Next the choose the chart design. Make sure Row or Columns is checked as the primary data source, then hit next again. It may be desirable to choose an off set pie chart for instance, this can be done on this screen.

Otherwise click on “create” and NeoOffice will work it’s magic. In a few second a brand new chart will be inserted on the worksheet specified. The edges of the chart can be grabbed with the mouse to expand the size of the chart. And it can be copy and pasted into a document, or even exported to a .gif file for posting on a web page.