Muffinresearch Labs by Stuart Colville

Checking tarball contents before extraction | 2 Comments

Posted in Code, Linux/Unix on 10th November 2008, 6:05 pm by

When you are about to unpack a tarball you didn’t create it’s a good idea to run the -t flag instead of just assuming it’s been packed in a sensible way.

tar -tzf foo.tar.gz

This lists all of the files in the tarball so you can be sure it’s not going to extract to somewhere you didn’t expect.

If you need tar to extract to a different location then you can use the -C flag to tell tar to cd to that directory first and then unpack the contents there.

Post Tools

  • http://www.peterbe.com Peter Bengtsson

    Use atools. It comes with apack and aunpack. Now you no longer need to remember the different options for tar, unzip, zip, rar, bz2 etc.
    Plus it ALWAYS puts things in a directory if the there are more than one file in the archive.

    To unpack
    $ aunpack foo.tgz
    $ cd foo

    To pack
    $ apack files.zip /home/peterbe/files

  • http://muffinresearch.co.uk Stuart Colville

    @Peter: Nice tip thanks

GNU screen: open tab in current working directory|(1)

A nice trick for having screen open a new tab in the same directory as the one you’re currently in. To use it add it to your .screenrc

# Open new window in current dir.
bind c stuff "screen -X chdir \$PWD;screen^M"
bind ^c stuff "screen -X chdir \$PWD;screen^M"

Hat tip: mteckert on SuperUser.com

Ubuntu: add-apt-repository: command not found|(3)

When you’re using a minimal Ubuntu install if you find the ‘add-apt-repository’ command is missing (it’s useful for adding PPAs and other repositories), then simply run:

sudo apt-get install python-software-properties

Photos on Flickr

© Copyright 2004-12 Stuart Colville, all rights reserved. May contain traces of Muffin. Powered by WordPress. Hosting by Slicehost.com This page was baked in 0.509s.