Finding symbolic links and their targets
Symbolic links are common in Unix-like systems. Reasons for using them range from convenient access, to maintaining multiple versions of the same library or program. This recipe will discuss the basic techniques for handling symbolic links.
Symbolic links are pointers to other files or folders. They are similar in function to aliases in MacOS X or shortcuts in Windows. When symbolic links are removed, it does not affect the original file.
How to do it...
The following steps will help you handle symbolic links:
- To create a symbolic link run the following command:
$ ln -s target symbolic_link_name
Consider this example:
$ ln -l -s /var/www/ ~/web
This creates a symbolic link (called web) in the current user's home directory, which points to /var/www/
.
- To verify the link was created, run this command:
$ ls -l ~/web lrwxrwxrwx 1 slynux slynux 8 2010-06-25 21:34 web -> /var/www
web -> /var/www
specifies that web
points to /var/www
.
- To print symbolic...