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
- Open your terminal.
- Type the
ln -scommand followed by the path to the target directory or file and the desired name for the symbolic link. - 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.
