The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
link files together fredao Shell Programming and Scripting 1 12-04-2006 06:24 PM
how find the link of the file Manish Jha Shell Programming and Scripting 8 01-05-2006 04:50 AM
Link files.... Tom Bombadil UNIX for Dummies Questions & Answers 1 05-11-2005 09:05 PM
Permissions on link files moviestud80 UNIX for Dummies Questions & Answers 2 04-01-2005 04:01 PM
Link files in unix yuvasyntel Shell Programming and Scripting 2 12-25-2002 08:55 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-28-2006
aju_kup aju_kup is offline
Registered User
  
 

Join Date: Jul 2006
Posts: 189
How to find link files

How to find the link files. i have main file, now i want to find all the files linked to it.
  #2 (permalink)  
Old 12-28-2006
becket's Avatar
becket becket is offline
Registered User
  
 

Join Date: Jul 2005
Location: Liege / Belgium
Posts: 36
symbolic link or hard link ?

for symbolic link ou can test -L file
for hard link you can test $( stat -c %h ) -ge 1
  #3 (permalink)  
Old 12-28-2006
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
This is the only way I know without resorting to C code, and assumes the links are symlinks and can be in any directory:
Code:
find / -type l  -exec ls -l {} \; | grep mainfile_name
This is not fast, so if you have lots of "mainfiles" you are looking modifying the grep
statement to use a pattern file with "mainfile" names.
  #4 (permalink)  
Old 07-02-2009
Sathish Kumar Sathish Kumar is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 1
find Command only displays soft link files. Is there any other way to list the hard link files too.
  #5 (permalink)  
Old 07-02-2009
Ramesh_srk Ramesh_srk is offline
Registered User
  
 

Join Date: Jun 2009
Location: Chennai,India
Posts: 20
Yes, we can find the list of hard link files using below command,

find . -links +1 -print

The -links +1 --> Will find all files that have MORE than 1 link. Hardlinked files have a link count of at least two.
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0