Unix/Linux Go Back    

Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

tar the symbolic link

Shell Programming and Scripting

Thread Tools Search this Thread Display Modes
Old Unix and Linux 05-23-2008   -   Original Discussion by ganga.dharan
ganga.dharan ganga.dharan is offline
Registered User
Join Date: Jan 2008
Last Activity: 26 September 2012, 3:41 PM EDT
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
tar the symbolic link

Hi Experts!!

Can anyone help me out to know how can we tar the symbolic links. I would need to find the symbolic links present in the directory and then tar them out. I can find the links by find . -type l, but i need to know how to tar the symboilc link. Any help would be much appreciated..

Many thanks !!
Sponsored Links
Old Unix and Linux 05-23-2008   -   Original Discussion by ganga.dharan
nua7 nua7 is offline
Registered User
Join Date: Mar 2008
Last Activity: 15 February 2016, 2:16 AM EST
Location: /bin/sh
Posts: 438
Thanks: 26
Thanked 4 Times in 4 Posts
Normally, when tar archives a symbolic link, it writes a record to the archive naming the target of the link. In that way, the tar archive is a faithful record of the filesystem contents. `--dereference' (`-h') is used with `--create' (`-c'), and causes tar to archive the files symbolic links point to, instead of the links themselves. When this option is used, when tar encounters a symbolic link, it will archive the linked-to file, instead of simply recording the presence of a symbolic link.

The name under which the file is stored in the file system is not recorded in the archive. To record both the symbolic link name and the file name in the system, archive the file under both names. If all links were recorded automatically by tar, an extracted file might be linked to a file name that no longer exists in the file system.

If a linked-to file is encountered again by tar while creating the same archive, an entire second copy of it will be stored. (This might be considered a bug.)

So, for portable archives, do not archive symbolic links as such, and use `--dereference' (`-h'): many systems do not support symbolic links, and moreover, your distribution might be unusable if it contains unresolved symbolic links.
Sponsored Links

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Symbolic Link Help LAVco Shell Programming and Scripting 2 06-07-2010 04:15 PM
symbolic link tonijel Shell Programming and Scripting 2 10-01-2009 07:23 AM
need some info about symbolic link and hard link detective linux UNIX for Dummies Questions & Answers 2 01-08-2008 07:36 AM
symbolic Link bhargav UNIX for Dummies Questions & Answers 1 10-15-2004 10:41 AM
1 symbolic link to 2 different places? Bashar UNIX for Advanced & Expert Users 2 08-27-2003 08:40 AM

All times are GMT -4. The time now is 04:29 PM.