The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Post Your Favorite UNIX/Linux Related RSS Feed Links Neo What's on Your Mind? 0 12-23-2007 08:41 AM
Question posting links hemangjani UNIX for Dummies Questions & Answers 5 02-25-2006 03:28 PM
Collection of Unix Links Kriss UNIX for Dummies Questions & Answers 0 01-08-2006 02:06 AM
All Linux and Unix commands Links devotedsinner News, Links, Events and Announcements 0 11-07-2005 03:49 AM
Unix History Question: Why are filenames/dirnames case sentsitive in Unix? deckard UNIX for Dummies Questions & Answers 3 03-26-2005 09:59 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-13-2006
Registered User
 

Join Date: May 2005
Posts: 17
A question for links in Unix

Is there a command that I can list, at once, all the links(path) of a give file ( including hard link and soft link)? If not, can it be down by writing a script? Thanks a lot.

(I know that pwd would only list one path.)
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-14-2006
Registered User
 

Join Date: Dec 2000
Location: Greater Dallas area
Posts: 405
I can't think of a way to list all the soft links.

To find the hard links, first run ls -li to find out the inode number of the file. Then do a find from the root of the file system (hard links do not cross mount points) for that inode.

Example from a Solaris 10 box:
Code:
> cd /usr/bin
> ls -li zcat
      3262 -r-xr-xr-x   3 root     bin        27176 Jan 22  2005 zcat
> find . -inum 3262
./compress
./uncompress
./zcat
>
In this case /usr/bin is the root file system, so I chose not to run the find from / as it would look in other file systems. The 3 between the file permissions and root means there are 3 links to one file.
__________________
[url=http://chuckb.1le.net/]My website[/url]
Reply With Quote
  #3 (permalink)  
Old 01-15-2006
Registered User
 

Join Date: May 2005
Posts: 17
Softlink may need to write a script to find out. Thank you very much for the help.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0