Thursday, August 18, 2011

Tar Files... Basic Tar Commands

Tar Files:

  1. Used to collect many files into a one larger file for distribution or archiving.
  2. It preserves file system information like user and group permissions, dates and directory structure.
  3. A ".tar" file is not a compressed files, it is a collection of files within a single file uncompressed. If the file is a .tar.gz ("tarball") or ".tgz" file it is a collection of files that is compressed.
  4. A compressed tar file is called a tarball.
 
Creating a tar file:
tar -cvwf file.tar myfile.txt
tar -cvwf myhome.tar home/

Extracting the files from a tar file:
tar -xvwf myfile.tar
tar -xvwzf myfile.tar.gz

I hope the above examples are self explanatory.. For various switches etc see Tar man pages.. Few important switches are:

  • c tells tar to create a new tar file
  • f tells tar to name it file.tar or myhome.tar as in above example
  • v verbose output, show, e.g., during create or extract, the files being stored into or restored from the tar file.
  • z use zip/gzip to compress the tar file or to read from a compressed tar file.
 

Wednesday, August 17, 2011

How can I know Ubuntu Distribution that I'm running

Its easy... Use:

cat /etc/lsb-release

This command will tell you the exact distribution that you are running. Uname on contrary just tells you the kernel version...

Tomcat7 Package for Ubuntu

Good news.. Tomcat7 package is available for Ubuntu now. It is for version 11.10 (oneiric). So all you need to do is upgrade your Ubuntu to 11.10 and you can install tomcat7 package directly.

Here is how you can upgrade your version of Ubuntu from 11.04 (natty) to 11.10 (oneiric)..

1.       Replace all natty in  /etc/apt/sources.list to oneiric.
2.       Now, run sudo aptitude update
3.       sudo aptitude full-upgrade 
4.      sudo apt-get autoclean

To install tomcat7, just run sudo apt-get install tomcat7... That's It!