Listing all links in a file system


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Listing all links in a file system
# 1  
Old 02-20-2007
Listing all links in a file system

How would one find and list all links in a file system? My situation is
that I built several servers for disaster recovery, mirror images of
several servers in our main location. Instead of doing a "ls -l" on every
file system down the /usr structor to verify that I have all the necessary
links created, can I use the "find" command (with what options) or some
other command line tool? I'd like to be able to list all links down the /usr
file system on both machines, pipe the information out to a couple of
files and then do a "diff" between the files to see if I missed any.

Ruger14
# 2  
Old 02-20-2007
Quote:
Originally Posted by ruger14
How would one find and list all links in a file system? My situation is
that I built several servers for disaster recovery, mirror images of
several servers in our main location. Instead of doing a "ls -l" on every
file system down the /usr structor to verify that I have all the necessary
links created, can I use the "find" command (with what options) or some
other command line tool? I'd like to be able to list all links down the /usr
file system on both machines, pipe the information out to a couple of
files and then do a "diff" between the files to see if I missed any.

Ruger14
Code:
find /usr -type l

Just a matter of reading the manual page for find.
# 3  
Old 02-21-2007
Even though it's probably what the original poster wanted, it's definitely worth stressing here that there is no easy way to find hard links (unless you write a script to find all files on each filesystem, and "uniq" the inode numbers of all files found - which will be slow and intensive).

find /blah -type l will only find symbolic links.

Cheers
ZB
# 4  
Old 02-21-2007
Quote:
Originally Posted by zazzybob
Even though it's probably what the original poster wanted, it's definitely worth stressing here that there is no easy way to find hard links (unless you write a script to find all files on each filesystem, and "uniq" the inode numbers of all files found - which will be slow and intensive).

find /blah -type l will only find symbolic links.

Cheers
ZB
For hard links:

Code:
find / -type f -links +2

Not that hard
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] How to remove listing of current user cmd from ps -ef listing?

Hi All, Could you please help to resolve my following issues: Problem Description: Suppose my user name is "MI90". i.e. $USER = MI90 when i run below command, i get all the processes running on the system containing name MQ. ps -ef | grep MQ But sometimes it lists... (8 Replies)
Discussion started by: KDMishra
8 Replies

2. Homework & Coursework Questions

Listing Live System Status

1. Edit a script named update.sh that generates status.html in your web directory: ~/public_html/. I need to write specific commands to show each specific item 2. The generated webpage should include information related to: UNIX : kernel version of ed-lab server USER : number of users on the... (13 Replies)
Discussion started by: devinj
13 Replies

3. AIX

List all the soft links and hard links

Hi I'm logged in as root in an aix box Which command will list all the soft links and hard links present in the server ? (2 Replies)
Discussion started by: newtoaixos
2 Replies

4. Solaris

Hard Links and Soft or Sym links

When loooking at files in a directory using ls, how can I tell if I have a hard link or soft link? (11 Replies)
Discussion started by: Harleyrci
11 Replies

5. Shell Programming and Scripting

recurssion via symbolic links without allowing system to act recursively?

I tried looking up combinations of the keywords "infinite loop links" in google before causing a recurring post here... but alas, I couldn't find much. Cause: I've created an infinite loop, in a way, of directories. Problem: I'm not sure if this will crash a backup program (trying to... (1 Reply)
Discussion started by: jzacsh
1 Replies

6. AIX

listing the whole system by filesize

Hi, Just wondered what command you would use to list all the files on Aix by filesize? I've tried a few but none of which seem to do the trick! Currently running du -m -a . | sort -rn | more as root Thanks, Matt. (1 Reply)
Discussion started by: elmesy
1 Replies

7. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies

8. UNIX for Dummies Questions & Answers

links working system wide

I have created symbolic links to several frequently used commands, for example: "lt" is a link to "ls -ltrgo|tail". What can I do to make these links available system-wide, or at least in the directories my coworkers are in most of the time? I have copied the link to several directories, and... (6 Replies)
Discussion started by: jpprial
6 Replies
Login or Register to Ask a Question