LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Find all symlinks and where they point to (https://www.linuxquestions.org/questions/linux-newbie-8/find-all-symlinks-and-where-they-point-to-4175608474/)

anon091 06-23-2017 12:08 PM

Find all symlinks and where they point to
 
I'm not having much luck running a command or commands that will find all the symlinks on a RHEL server and also tell me where they actually link to. Does anyone know how to do that?

Demosa 06-23-2017 12:19 PM

To find all the symlinks
Code:

find / -type l
We can send these results to ls -l to see the links
Code:

find / -type l -exec ls -l {} \;
Since this will probably have access errors, send them to /dev/null
Code:

find / -type l -exec ls -l {} \; 2> /dev/null

But you don't want to find all of them (there's a ton of links for devices and such), you probably just want them in a specific directory, so replace `/` with the path you want to search (i.e. `/etc/` or `/home/user/`)

BW-userx 06-23-2017 12:23 PM

for got tail end
Code:

sudo find / -type l -exec ls -l {} \; <--
Code:

lrwxrwxrwx 1 userx 1000 25 Jun 12  2012 /media/slack-mirror/slackware64-14.2/source/a/mkinitrd/busybox-dot-config -> busybox-dot-config.1.20.x
lrwxrwxrwx 1 userx 1000 11 Aug 23  2009 /media/slack-mirror/slackware64-14.2/isolinux/sbootmgr/RAWRITE13.EXE -> RAWRITE.EXE
lrwxrwxrwx 1 userx 1000 15 Aug 23  2009 /media/slack-mirror/slackware64-14.2/slackware64/PACKAGES.TXT -> ../PACKAGES.TXT
lrwxrwxrwx 1 root root 7 Jun 18 05:14 /media/memory -> memory0
lrwxrwxrwx 1 root root 7 Jun 18 05:14 /media/floppy -> floppy0
lrwxrwxrwx 1 root root 4 Jun 18 05:14 /media/dvd -> dvd0
lrwxrwxrwx 1 root root 11 Jun 18 05:14 /media/cdrecorder -> cdrecorder0
lrwxrwxrwx 1 root root 6 Jun 18 05:14 /media/cdrom -> cdrom0


Demosa 06-23-2017 12:25 PM

Thanks, fixed

anon091 06-23-2017 12:36 PM

Awesome, many thanks!


All times are GMT -5. The time now is 01:35 PM.