- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Finding hardlinked file.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:22 AM
08-21-2000 11:22 AM
I want to list all files in a directory that is hardlinked to any other files anywhere in my system. Is there a simple command to do that besides writing a script?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:26 AM
08-21-2000 11:26 AM
Re: Finding hardlinked file.
(see man ls, F option).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 11:36 AM
08-21-2000 11:36 AM
Re: Finding hardlinked file.
For example:
#touch /tmp/test
#ll /tmp/test
-rw-rw-r-- 1 root sys 0 Aug 21 15:26 test
#ln /tmp/test /tmp/test5
#ll /tmp/test*
-rw-rw-r-- 2 root sys 0 Aug 21 15:26 test
-rw-rw-r-- 2 root sys 0 Aug 21 15:26 test5
Notice field 2 changed from 1 to 2. You know that a hard link has been created and there are now 2 filenames pionting to the same data.
I won't get into using this info in a script but just thought I would share it.
Tony
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2000 01:07 PM
08-21-2000 01:07 PM
SolutionHard linked files must always be on the same file system.
First, determine the inode number of the file for which you want to determine the hard linked files:
ls -i your_filename
The inode is listed.
Then, use find to find all files having that same inode number:
find /your/directory -xdev -inum your_inode
That should do the trick.
Bye,
Rik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2000 01:18 PM
08-22-2000 01:18 PM
Re: Finding hardlinked file.
how about something like:
dev=`devnm .| cut -d' ' -f1`
ls -i1 * | while read inum name ; do echo $name; ncheck -a -i $inum $dev ";"; done
that should find all hardlinks of all files in your working directory.
HTH,
Wodisch