Compdigitec Labs

« | Home | »

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%.

  1. ln -s TARGET LINKNAME – Creates a symbolic link (shortcut on Windows) called LINKNAME that points to TARGET. This works with both folders and files.
  2. 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“.
  3. 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.
  4. 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.
  5. (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.
  6. (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 | 4 Comments »

4 Responses to “Manipulating symbolic and hard links on Linux and Windows”

  1. read Says:
    February 2nd, 2024 at 09:52

    … [Trackback]

    […] Read More on on that Topic: […]

  2. torqeedo electric motor|achiles boat|achillies inflatable boat|yamaha vmax 2021|avon boats|achilies boats|achillies inflatable boats|200 hp merc outboard|avon inflatable boats|avon boat|avon inflatable boat|honda boats|200hp mercury outboard|achillies inflatable boat|avon inflatables|200 hp mercsury outboard|yamaha 250 hp outboard|outboard jet motors for sale|4hp yamaha outboard|best 25 hp outboard|jet outboard motors for sale|yamaha extended warranty|yamaha 300hp outboard|used outboard jet motors for sale|70 hp outboard|2.5 hp mercury outboard|250hp outboard|mercury 30 horsepower outboard|outboard dealer|yamaha 4 hp outboard|25hp mercury|tohatsu 6hp|mercury 200 outboard|yamaha jet outboard|2.5 mercury outboard|yamaha 300 hp outboard|honda outboard engines|70 hp boat motor|inmar boats|merc 25 hp outboard|tohatsu 60hp|inmar boat|9.9hp mercury outboard|mercury 25 hp outboards|jet outboard motor|inflatable zodiac boats for sale|propane outboard|25 hp mercury outboard|honda outboard dealer near me|9.9 hp mercury Says:
    February 8th, 2024 at 02:59

    … [Trackback]

    […] There you can find 12505 more Information to that Topic: […]

  3. สล็อตวอเลท Says:
    February 15th, 2024 at 21:06

    … [Trackback]

    […] Info to that Topic: […]

  4. บอลยูโร 2024 Says:
    February 17th, 2024 at 09:33

    … [Trackback]

    […] Here you can find 35435 additional Information on that Topic: […]