- Linux Shell Scripting Cookbook(Third Edition)
- Clif Flynt Sarath Lakshman Shantanu Tushar
- 143字
- 2021-07-09 19:46:30
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 links in the current directory, use this command:
$ ls -l | grep "^l"
- To print all symbolic links in the current directory and subdirectories, run this command:
$ find . -type l -print
- To display the target path for a given symbolic link, use the readlink command:
$ readlink web /var/www