spacer
Web Development Tutorials LINUX Tutorials
 Developer Newsletter

Tutorials
AJAX
ASP
CGI & Perl
CSS
Flash
HTML
Illustrator
Java
JavaScript
Linux
MySQL
PHP
Photoshop
Python
Wireless
XML
Miscellaneous


Scripts Directory
AJAX Scripts
ASP Scripts
ASP.NET Scripts
CGI & Perl Scripts
Flash Scripts
Java Scripts
JavaScript Scripts
PHP Scripts
Python Scripts
Remotely Hosted Scripts
Tools & Utilities Scripts
XML Scripts

Web Hosting Directory
ASP.NET
Budget
Dedicated Servers
Ecommerce
Linux
Resellers
Shared
Small Business
Windows

Developer Manuals
Learn HTML
Learn PHP
Learn CSS
Learn AJAX
Learn JavaScript
Learn Pear
Free White Papers

Developer Resources
Developer Tools
Developer Content
Survey Software
Dedicated Servers




Symlinks

By Tony Lawrence
2005-10-19


Symlinks

Linux "symlinks" is a handy utility for managing symbolic links. It can clean up the sort of problems that come from carelesness when creating symbolic links. For purposes of illustration, I created some legal but structurally incorrect symbolic links. With the exeption of the "dangling" sl3 (a dangling symlink points somewhere that does not exist), these all work, but they have problems, and "symlinks -v" will show us:

$ symlinks -v -s .

messy: /home/tony/varwwwmess -> /var//www
dangling: /home/tony/sl2 -> ../incoming
lengthy: /home/tony/sl3 -> ../tony/incoming
other_fs: /home/tony/varwww -> /var/www
absolute: /home/tony/vhosts -> /home/httpd/vhosts/
relative: /home/tony/webby -> vhosts/webby.com

That's helpful. Even more helpful is that symlinks can clean this stuff up in a flash:

$ symlinks -c -s .

messy: /home/tony/varwwwmess -> /var//www
changed: /home/tony/varwwwmess -> /var/www
dangling: /home/tony/sl2 -> ../incoming
lengthy: /home/tony/sl3 -> ../tony/incoming
changed: /home/tony/sl3 -> incoming
other_fs: /home/tony/varwww -> /var/www
absolute: /home/tony/vhosts -> /home/httpd/vhosts/
changed: /home/tony/vhosts -> ../httpd/vhosts
$ symlinks -v -s .
other_fs: /home/tony/varwwwmess -> /var/www
relative: /home/tony/sl3 -> incoming
dangling: /home/tony/sl2 -> ../incoming
other_fs: /home/tony/varwww -> /var/www
relative: /home/tony/vhosts -> ../httpd/vhosts
relative: /home/tony/webby -> vhosts/webby.com

The -c fixes all problems, but does leave the dangling link. To remove it:

$ symlinks -d .

other_fs: /home/tony/varwwwmess -> /var/www
dangling: /home/tony/sl2 -> ../incoming
deleted: /home/tony/sl2 -> ../incoming
other_fs: /home/tony/varwww -> /var/www

"symlinks" can operate recursively with "-r" and can show you its actions with "-t".



Tutorial Pages:
» Symlinks


© Copyright 2005 A.P. Lawrence


 | Bookmark Print |   Write For Us
Related Tutorials:
» How to Install PHP 5 on Linux
» How to Install Apache 2 on Linux
» How to Install MySQL 5.0 on Linux
» SMB Caching
» Mound --Bind
» Tar Wild Card Interpretation



About the NetVisits, Inc Network | Write For Us | Advertise
Copyright ©2007 NetVisits, Inc Network. All Rights Reserved. Privacy Policy.
Visit other NetVisits, Inc. sites: