« Changing the user agent of PHP | Home | Aliases for common command line typos »
Manipulating symbolic and hard links on Linux and Windows
By admin | August 23, 2008
Symbolic and hard links are a very convenient feature of the Linux and UNIX operating systems – they enable you to create a short alias, use it to avoid duplicate data and much, much more. They are also availible on Windows to a limited extent – NTFS supports only hard links while FAT/FAT32/VFAT supports neither. However, using Cygwin, you can use Windows shortcuts as symbolic links, but that is as far as it gets.
To create symbolic and hard links in Linux, make sure you have the GNU Coreutils installed, which provides the ln utility.
To create hard links and shortcuts in Microsoft Windows, download ln for Windows and place in a directory inside your %PATH%.
ln -s TARGET LINKNAME
– Creates a symbolic link (shortcut on Windows) called LINKNAME that points to TARGET. This works with both folders and files.ln TARGETFILE LINKNAME
– Creates a hard link called LINKNAME that points to the file TARGETFILE. Only works for files; if you try to do it with a folder, the error message “ln: `/folder/name/here‘: hard link not allowed for directory“.ln -i COMMAND
– Runs ln interactive mode, where it will ask you before running the command COMMAND, where the COMMAND is one of the commands above.ln -f COMMAND
– Forces ln to override any existing files while running the command COMMAND. For example, if you do ln -s /bin file and currently file exists, you will get “ln: creating (symbolic/hard) link `linkname‘: File exists“. Use ln -f /bin file to make it work.- (Windows only) You remove fake symbolic links (shortcuts) with
del linkname.lnk
to accommodate the fact that it is a Windows shortcut. You can remove hard links the normal way you delete a file –del hardlinkname
. - (Linux only) You remove symbolic and hard links the regular way you would remove files –
rm yourlinkname
.
If you found this article useful or helpful, please help Compdigitec spread the word or please leave a comment. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!
If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!
Topics: Linux, Windows | 19 Comments »
March 9th, 2022 at 17:58
… [Trackback]
[…] Find More on to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
March 15th, 2022 at 10:37
… [Trackback]
[…] Information to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
April 2nd, 2022 at 19:37
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
April 21st, 2022 at 05:26
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
April 23rd, 2022 at 07:12
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
July 17th, 2022 at 05:23
… [Trackback]
[…] Read More on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
July 30th, 2022 at 06:48
… [Trackback]
[…] There you can find 73463 more Info on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
August 31st, 2022 at 10:15
… [Trackback]
[…] Here you will find 53651 more Information to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
August 31st, 2022 at 12:23
… [Trackback]
[…] Read More on on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
September 4th, 2022 at 18:12
… [Trackback]
[…] Info on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
September 12th, 2022 at 16:26
… [Trackback]
[…] There you can find 63034 more Information on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
October 8th, 2022 at 23:16
… [Trackback]
[…] Find More Info here to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
January 8th, 2023 at 09:17
… [Trackback]
[…] Read More to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
January 11th, 2023 at 11:53
… [Trackback]
[…] Info to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
January 23rd, 2023 at 06:44
… [Trackback]
[…] Read More on to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
January 28th, 2023 at 07:56
… [Trackback]
[…] Here you can find 2387 more Info on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
February 4th, 2023 at 03:17
… [Trackback]
[…] There you can find 91953 additional Info on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
February 28th, 2023 at 17:16
… [Trackback]
[…] Read More to that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]
March 5th, 2023 at 10:41
… [Trackback]
[…] There you will find 74613 more Information on that Topic: compdigitec.com/labs/2008/08/23/manipulating-symbolic-and-hard-links/ […]