![Linux Shell Scripting Cookbook(Third Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/161/36701161/b_36701161.jpg)
上QQ阅读APP看书,第一时间看更新
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