LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-23-2017, 01:08 PM   #1
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Rep: Reputation: 49
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?
 
Old 06-23-2017, 01:19 PM   #2
Demosa
Member
 
Registered: Feb 2013
Distribution: Fedora 25, RHEL7, RHCI stack
Posts: 38

Rep: Reputation: Disabled
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/`)

Last edited by Demosa; 06-23-2017 at 01:26 PM. Reason: Cleanup (code-blocks) - fixed
 
2 members found this post helpful.
Old 06-23-2017, 01:23 PM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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

Last edited by BW-userx; 06-23-2017 at 01:25 PM.
 
2 members found this post helpful.
Old 06-23-2017, 01:25 PM   #4
Demosa
Member
 
Registered: Feb 2013
Distribution: Fedora 25, RHEL7, RHCI stack
Posts: 38

Rep: Reputation: Disabled
Thanks, fixed
 
Old 06-23-2017, 01:36 PM   #5
anon091
Senior Member
 
Registered: Jun 2009
Posts: 1,795

Original Poster
Rep: Reputation: 49
Awesome, many thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
untarred symlinks point to / sgmeunier Linux - Software 1 03-04-2008 05:31 AM
Upgrade qt3 -> qt4. Symlinks still point to qt3 alar Linux - Software 1 06-07-2007 10:45 PM
find mount point given device kornelix Programming 2 04-13-2007 10:01 AM
How to find the mount point for my cd-rw in cdrecord sirius57 Linux - Hardware 7 04-04-2006 07:17 PM
can't find the acces point Supergirl Linux - Wireless Networking 9 01-12-2005 10:22 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration