Results 1 to 8 of 8

Thread: List symlinks point to target file

  1. #1
    Join Date
    Dec 2006
    Location
    Morelia, México
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    Question List symlinks point to target file

    This seems like it should be a simple thing to do, and maybe I just have the dumb today. A long time ago, I created a symlink to a file. Now I'm looking at the file trying to remember where I created the symlink. Is there a converse to "ls -l" or "readlink" that will list the references pointing to a target file? I went through the manpages for ls and ln and couldn't find anything, nor did my handy "Linux Pocket Guide" have any insight to share. Any ideas?

    Thanks!
    Brian Napoletano
    b.napoletano@gmail.com

  2. #2
    Join Date
    Dec 2006
    Location
    Morelia, México
    Beans
    60
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: List symlinks point to target file

    I resolved my issue without answering this question. Anybody know the magic command or flag?
    Brian Napoletano
    b.napoletano@gmail.com

  3. #3
    Join Date
    May 2009
    Location
    Jah's Pocket
    Beans
    733
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: List symlinks point to target file

    only thing i cud think of would be this
    Code:
    ls -l | grep "\-> /etc"
    replacing the /etc with the location or file it pointed to.
    MyBlog
    Sledgehammer engineering, if it doesn't work, hit it damn hard.

  4. #4
    Join Date
    Sep 2007
    Beans
    1

    Re: List symlinks point to target file

    Combine that with a find / I guess

  5. #5
    Join Date
    Feb 2007
    Beans
    22

    Re: List symlinks point to target file

    find / -type l

    will give you all the symlinks on your system

  6. #6
    Join Date
    May 2009
    Location
    Jah's Pocket
    Beans
    733
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: List symlinks point to target file

    If you are looking to go through the entire file system then yes it would just add ls -lR / to the front of the command instead of ls -l.
    MyBlog
    Sledgehammer engineering, if it doesn't work, hit it damn hard.

  7. #7
    Join Date
    Aug 2009
    Beans
    1

    Re: List symlinks point to target file

    To find all symbolic links to the file /home/me/foo on the whole filesystem:
    Code:
    find / -lname /home/me/foo

  8. #8
    Join Date
    Sep 2010
    Beans
    1

    Re: List symlinks point to target file

    http://ubuntuforums.org/showpost.php...94&postcount=5

    to exclude same paths (for example /dev and /sys)
    Code:
    find /!(dev|sys) -follow -inum <inode number>

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •