How to create a symbolic link?

093

To create a symbolic link in Linux, you can use the ln -s command. Here’s the syntax and an example:

Syntax

ln -s [target_directory_or_file] [link_name]

Example

If you want to create a symbolic link named my_link that points to a directory /home/user/my_directory, you would use the following command:

ln -s /home/user/my_directory /home/user/my_link

Steps

  1. Open your terminal.
  2. Type the ln -s command followed by the path to the target directory or file and the desired name for the symbolic link.
  3. Press Enter.

Verification

To verify that the symbolic link was created successfully, you can use the ls -l command:

ls -l /home/user/my_link

This will show you the link and its target.

0 Comments

no data
Be the first to share your comment!