Linux Command To Create Link
Chapter:
Linux Commands
Last Updated:
15-11-2019 09:06:51 UTC
Program:
/* ............... START ............... */
ubuntu@ubuntu:~/Desktop$ ln -s ~/test.sh LinkName // Command will create a new link to file ~/test.sh
ubuntu@ubuntu:~/Desktop$ ln -sf ~/test.sh LinkName // -sf parameter is used to update the existing link.
ubuntu@ubuntu:~/Desktop$ ls -lrt LinkName // ls -lrt will give the details of link (Link location)
lrwxrwxrwx 1 ubuntu ubuntu 20 Nov 15 00:58 LinkName -> /home/ubuntu/test.sh
/* ............... END ............... */
Output
Notes:
-
Command used to make symbolic link in Linux is "ln".
- Syntax : ln [OPTION]... [-T] TARGET LINK_NAME
- Linux command to create a new link : ln -s filelocation linkName
- ln is link command, -s is parameter to create new link, filelocation mentions the file location and linkName is the name of the symbolic link.
- Commmand to update the existing link in Linux using command line : ln -sf filelocation linkName
- To update the existing link you have to use -sf, it will update the link with the new filelocation.
- ls -lrt linkName will give the details of the link and location to which it is linking. (LinkName -> /home/ubuntu/Downloads/test.sh).
- For more information you can refer the program section and output for more clarification regarding this.
Tags
linux create symbolic link directory, links command in linux, How to update existing link in linux.