|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
change target of a symbolic link
Hi,
Is it possible to change the target of a symbolic link? What I currently have is: /home/Data1 /home/Data2 /home/Stores In the Stores directory, I did: ln -s /home/Data1 /home/Stores/abc $ pwd /home/Stores $ ls -latr lrwxrwxrwx 1 dandy dandy 46 Feb 12 16:38 abc -> /home/Data1 I want to now change that target to: abc -> /home/Data2 BUT, I don't want to do have to delete the link and re-create it to the new target. I just want to rename/change/modify the target. Is it possible? Thanks |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Yes it is possible
|
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
So how do you change the target of a symlink?
|
|
#4
|
|||
|
|||
|
Very interested to hear fpmurphy's explanation on how to change target of symlink without deleting the symlink first.
I normally delete the symlink and re-create it on one line, minimizing the time the link does not exist: rm mysymlink ; ln -s mytargetfile mysymlink I suppose you could write a little hack which does it in one go, but I've never heard of one which is included in standard POSIX systems... |
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
fpmurphy is absolutely correct...yes you can change the target of a soft link without deleting the old one by forcing ln to do so. Code:
ln -s /home/Data1 /home/Stores/abc ln -f -s /home/Data2 /home/Stores/abc |
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
wow, thanx
![]() |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Symbolic Link Help | LAVco | Shell Programming and Scripting | 2 | 06-07-2010 03:15 PM |
| symbolic link | tonijel | Shell Programming and Scripting | 2 | 10-01-2009 06:23 AM |
| Bash: return target of symbolic link | mglenney | Shell Programming and Scripting | 2 | 07-22-2009 03:15 AM |
| ZIP a soft / symbolic link target | galz | UNIX for Dummies Questions & Answers | 1 | 06-10-2008 04:36 AM |
| need some info about symbolic link and hard link | detective linux | UNIX for Dummies Questions & Answers | 2 | 01-08-2008 06:36 AM |
|
|