Linux Command To Create Link

Chapter: Linux Commands Last Updated: 15-11-2019 09:06:51 UTC

Program:

            /* ............... START ............... */
                

[email protected]:~/Desktop$ ln -s ~/test.sh LinkName    // Command will create a new link to file ~/test.sh

[email protected]:~/Desktop$ ln -sf ~/test.sh LinkName  // -sf parameter is used to update the existing link.


[email protected]:~/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


            Linux Command To Create Link
        

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.
Similar Programs Chapter Last Updated
Linux Version Command Linux Commands 01-12-2020
Unzip Command In Linux Linux Commands 20-11-2019
Process Command In Linux Linux Commands 16-11-2019
Linux Command To View File Content Linux Commands 25-10-2019
Linux Command To Check OS Version Linux Commands 25-10-2019
Netstat Command In Linux Linux Commands 13-08-2019
Telnet Command In Linux Linux Commands 13-08-2019
Linux Command To Create A File Linux Commands 23-05-2019
Linux echo Command Linux Commands 05-05-2018
Linux Ping Command Linux Commands 05-05-2018
Linux ls (List Directory) Command Linux Commands 17-03-2018

1