Find the answer to your Linux question:
Results 1 to 5 of 5
I've read some tutorials, but have not stumbled on this, so.. how do i find the file to which a symbolic link points to thanks...
  1. #1
    Just Joined!
    Join Date
    Oct 2007
    Posts
    31

    How do i find the file where symlink points to?

    I've read some tutorials, but have not stumbled on this,
    so..

    how do i find the file to which a symbolic link points to



    thanks

  2. #2
    Just Joined! g00rkha75's Avatar
    Join Date
    Jul 2008
    Location
    Jakarta, Indonesia
    Posts
    7
    Hi,

    Just run this command:
    Code:
    [root@greg named]# ls -l
    lrwxrwxrwx  1 root root      22 Jul  3 00:12 grub.conf -> ../boot/grub/grub.conf
    From the output lrwxrwxrwx, the l means that its the soft link grub.conf pointing the real one which is located in ../boot/grub/grub/conf
    For finding the file which it points to run this
    Code:
    find / -name grub.conf -print[/B] or [B]# locate grub.conf
    Hope it helps.

    Rgds,
    g
    Last edited by devils casper; 07-22-2008 at 09:32 AM. Reason: Added [code]...[/code] tags.

  3. #3
    Linux Engineer Freston's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    1,047
    And the 'file' command does the same thing:
    Code:
    file /path/to/symlink
    symlink: symbolic link to `/example/targetfile'
    Can't tell an OS by it's GUI

  4. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    And the -L option to ls will unroll the link and give you stats on the real file.

  5. #5
    Just Joined!
    Join Date
    Aug 2009
    Posts
    3

    readlink

    try out the 'readlink' command.
    'readlink' will "display value of a symbolic link on standard output."

    If you really just want the link and nothing else you can add '-n'
    "-n, --no-newline do not output the trailing newline"
    Last edited by BryanFRitt; 08-11-2009 at 04:31 PM. Reason: formated text

Posting Permissions

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