≡ Menu

tar command

How to compile program under Linux / UNIX / FreeBSD

Q. I've downloaded tar ball software but I don't know how to compile the same? Can you provide the instructions for compiling a program?

A. Many new users find it difficult to compiling programs in Linux. Usually following steps are involved:

a] Download tar ball using wget

b] Untar tar ball using tar command

c] Compile program using make or configure command

d] Install software

Task: compiling program

Step # 1: Download program tar ball:
$ wget http://url-com/prog.tar.gz
Step # 2: Untar tar ball :
$ tar -zxvf prog.tar.gz
$ cd prog

Step # 3: Untar tar ball:
Configure program:
$ ./configure
Compile program:
$ make
Install program (must be run as the root, login using su or use sudo):
$ sudo make install
$ su -
$ make install

Backup CentOS Linux RPM database

Q. How do I backup CentOS Linux server RPM database?

A. /var/lib/rpm directory stores all files used by rpm command. All files inside this directory are binary files. It has the information about all installed package. You can easily backup all files using following method.

Backup Linux RPM Database stored at /var/lib/rpm directory

a) Login as the root user.

b) First remove any stale lock file, enter:
/bin/rm -f /var/lib/rpm/__db*

c) The next step is to back up the /var/lib/rpm directory, using tar command:
# tar czvf $(hostname).rpmdatabase.tar.gz /var/lib/rpm
If your hostname is linux-server, it will save backup to a file called linux-server.rpmdatabase.tar.gz

Solaris UNIX Tape Backup And Recovery With tar And cpio Commands

We have recently brought a new Sun Solaris UNIX server. How do I Backup data and make a recovery for the Solaris OS using tar and tape device?
[click to continue…]

How do I backup Thunderbird mail and profile under Linux?

Q.I'm Ubuntu Linux user and I'd like to keep backup of my email and mail settings. How do I backup Thunderbird mail and profile under any Linux distribution?
[click to continue…]

Verify tar command tape backup under Linux or UNIX

Q. I am using tar command to backup data to tape. How do I verify that tape backup is in a good condition?

A. GNU/tar has -w or --verify option. This option attempt to verify the archive after writing it to tape, use command as follows to backup and verify the backup.

Verify TAR backup with -w and --verify options

Type the command as follows to backup /home to /dev/st0 and attempt to verify the archive after writing it /dev/st0.
# tar -cvpWlf /dev/st0 /home

c : create a new archive of /home
v : Verbose output
p : Ignore umask when extracting files i.e. preserve permissions on files
W : attempt to verify the archive after writing it
l : stay in local file system when creating an archive
f : Specify /dev/st0 as tape device (file)
/dev/st0: Tape device name.
/home : Directory to backup

For more information see:

Exclude Certain Files When Creating A Tarball Using Tar Command

How can I keep out certain files when creating a tarball? For example:


How do I exclude zyz and abc file while using a tar command?
[click to continue…]

Backup Home Directories in Linux

Q. I would like to Backup all directories in /home to /dev/st0 tape drive. How do I use script to automate task and what commands do I need to use?
[click to continue…]

Linux Tape Backup With mt And tar Command Howto

Magnetic tape is a non-volatile storage medium consisting of a magnetic coating on a thin plastic strip. Nearly all recording tape is of this type, whether used for video, audio storage or general purpose digital data storage using a computer. How do I make backup using tapes under Linux operating systems?
[click to continue…]

Howto: Use tar Command Through Network Over SSH Session

How do I use tar command over secure ssh session?
[click to continue…]

How do I Compress a Whole Linux or UNIX Directory?

How can I compress a whole directory under a Linux / UNIX using a shell prompt?
[click to continue…]