Sponsored Content
Full Discussion: finding links to a file
Top Forums Shell Programming and Scripting finding links to a file Post 302182175 by ohagar on Saturday 5th of April 2008 08:38:58 PM
Old 04-05-2008
finding links to a file

I am writing a shell script that needs to files that are links to on specific shell script.

e.g.

/usr/bin/a.sh

/home/mydir/a.sh --> /usr/bin/a.sh
/home/yourdir/a.sh --> /usr/bin/a.sh
/home/hisdir/a.sh --> /usr/bin/a.sh
/home/herdir/a.sh --> /usr/bin/a.sh

I know I can set myself at the /home and "find" the links, but my question is more to the guru types. Is there a simple command that I can use on /usr/bin/a.sh to get the list of all the files that have links to it?
It might give output like:

# lnk2file /usr/bin/a.sh
/home/mydir/a.sh
/home/yourdir/a.sh
/home/hisdir/a.sh
/home/herdir/a.sh
#

Just want to know if there is a better way to skin this cat.

TIA

hagar
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Finding symbolic links

How can I find all symbolic links across the network to a directory (2 Replies)
Discussion started by: mehtad
2 Replies

2. UNIX for Dummies Questions & Answers

Symbolic Links for a File

how do i get the list of symbolic link names for a particular file programatically (4 Replies)
Discussion started by: b_u_n_1234
4 Replies

3. Shell Programming and Scripting

How to get all the links of a file?

Hi all, I have several links to a file. Is there any command or anyway to get all those links. Thanks in advance -Chanakya (3 Replies)
Discussion started by: Chanakya.m
3 Replies

4. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: ruger14
3 Replies

5. UNIX for Dummies Questions & Answers

Showing a file's symbolic links

ls -l shows the number of links for each file. Is there a command that will show the link sources for a specific file? Running find on the entire filesystem and doing a little Perl "magic" is the only method I'm aware of. I'm running SunOS 5.8. Thanks. (6 Replies)
Discussion started by: effigy
6 Replies

6. Shell Programming and Scripting

Finding and replacing links

Hi, I would like to do a scripting for finding the links based on the name I have and replace the links with the new name. General find command lists everything for that links ( means all the sub-sirs and all the files), i need only the main link and replace. Can you anyone give me some... (1 Reply)
Discussion started by: rrb2009
1 Replies

7. 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

8. 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
shells(4)							   File Formats 							 shells(4)

NAME
shells - shell database SYNOPSIS
/etc/shells DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser- shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root. A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines which search the file. Blank lines are also ignored. The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/ksh93, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh, /bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/ksh93, /usr/bin/pfcsh, /usr/bin/pfksh, /usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh, and /usr/sfw/bin/zsh. /etc/shells overrides the default list. Invalid shells in /etc/shells could cause unexpected behavior, such as being unable to log in by way of ftp(1). FILES
/etc/shells list of shells on system SEE ALSO
vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4) SunOS 5.11 20 Nov 2007 shells(4)
All times are GMT -4. The time now is 11:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy