How do you create a symbolic link?

Answer

Use ln -s target link_name. The -s flag creates a symbolic (soft) link. Without -s, a hard link is created. Example: ln -s /var/www/html/current /var/www/html/latest. To link a binary: ln -s /usr/local/bin/python3.11 /usr/local/bin/python3. Use absolute paths for the target when the link might be accessed from different directories. ls -la shows the symlink and where it points. To remove a symlink: rm linkname (do NOT use rm -r on a symlink to a directory — it may delete the target contents).