LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 11-17-2008, 05:32 AM   #1
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Rep: Reputation: 15
Post how to find full path for soft links


If we use the following command
Code:
$ls -lR /dir/to/path/ | grep lrwxrwxrwx
we can find all the soft links. Then how get the complete path of link and the dir/file it was to?
 
Old 11-17-2008, 05:51 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
While in the directory that has the link,
the command: ls -al will show it.
 
Old 11-17-2008, 06:20 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
You can try the readlink command. Moreover to find all the links in a certain directory you can try the find command using the -lname test. For example:
Code:
find /path/to/dir -lname \* -exec readlink -f {} \;
 
Old 11-17-2008, 06:42 AM   #4
bkcreddy17
Member
 
Registered: Feb 2008
Location: India-Hyderabad
Distribution: RHEL and Fedora
Posts: 171

Original Poster
Rep: Reputation: 15
Code:
ls -al
is to see file/dir in same dir. I want recursively an with complete path. If we find or locate command how will show? Just similar to that i want to find all soft links with theit complete path.
 
Old 11-17-2008, 07:11 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by bkcreddy17 View Post
Code:
ls -al
is to see file/dir in same dir. I want recursively an with complete path. If we find or locate command how will show? Just similar to that i want to find all soft links with theit complete path.
Maybe you missed my post above...
 
Old 11-17-2008, 07:21 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Quote:
Originally Posted by bkcreddy17 View Post
If we use the following command
Code:
$ls -lR /dir/to/path/ | grep lrwxrwxrwx
we can find all the soft links. Then how get the complete path of link and the dir/file it was to?
I don't want to nitpick----well, maybe I do..---The expression above finds only the soft links which have permissions rwxrwxrwx
.
What you might need is "grep ^l"
 
Old 11-17-2008, 01:03 PM   #7
pauledwards03
Member
 
Registered: Dec 2006
Distribution: Slackware 12.1
Posts: 94

Rep: Reputation: 15
perhaps the file command could help. It does a lot more but it will also tell you what the link points to.

Code:
file filename

Last edited by pauledwards03; 11-17-2008 at 01:04 PM.
 
  


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
Printing full path name for sym links using ls command rlinuxr Linux - Software 9 08-31-2008 11:25 AM
How-to : get full path of each file after applying find and cut kaprasanna Linux - General 1 01-07-2008 02:19 AM
technical question about hard links v soft links 7stud Linux - Newbie 2 02-23-2007 07:57 PM
links (hard links and soft links..) sachitha Programming 1 08-10-2005 01:10 PM
Soft Links varunbihani Linux - Newbie 3 06-05-2005 12:42 AM


All times are GMT -5. The time now is 01:02 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration