Labels

APPLE (1) astro (1) IDL (4) life (2) linux (5) LSD (2) Mac (2) teaching (1) volleyball (2) work (1)

Thursday, December 2, 2010

Useful Linux Commands

1. tar - tape archive and gzip - gnu zip

Creating a tape archive:

tar -cf archive.tar myDirectory/

Note - using the "v" flag prints out extra messages, as verbose mode, though it's not related to extracting files.

Listing the contents of an archive:

tar -tf archive.tar

It is generally a good idea to preview the contents of tape archives before unpacking them. This can become a serious problem if you are currently root, and the archive just happens to jump out of the current directory, and write over some important system files.

Extracting all files from an archive:

tar -xf archive.tar

To extract just partial pieces from the archive, supply a file or directory name after the archive name. You can list as many as desired here, separated by spaces.

tar -xf archive.tar filename


This is a gnu utility that is used to compress/decompress a file. Generally, if there is a set of files to compress, they will be sent through tar first to create a single file.

Compress:

gzip archive.tar

Decompress:

gunzip archive.tar.gz

No comments: