• Home
  • Docker
  • Kubernetes
  • LLMs
  • Java
  • Ubuntu
  • Maven
  • Big Data
  • Archived
Linux-Ubuntu | ln -- make links
  1. Notes
  2. Examples
  3. Command Help (man ln)

  1. Notes

    • Symbolic links work like shortcuts referencing another file.

    • Hard links are literally another name for the same file.
      A hard link file is a link to the original file that contains information about it.
      Both the hard link file and the original file are physically representing the same file (content).

    By default, ln makes hard links.

    Note that when you copy a symbolic link file (or a hard link file), you are copying the original file.
  2. Examples
    • Symbolic Links

      • Create a symbolic link to file1:
        Note the symbol -> after the symbolic link file name.
        Note also the size of the symbolic link file (5 bytes versus 8163 bytes of the original file).

        You can use the option -i to print the inode number of each file (which show that both are distinct physical files):

      • Create multiple symbolic links:
    • Hard Links

      • Create a hard link to file1:

        Note the link count (number after after the permission info) show the same number for both files: two links (because we have created a symbolic link to file1).
        Note also the size of the hard link file (both the hard link file and the original file have the same size: 8163 bytes).

        You can use the option -i to print the inode number of each file (which show that both files are referencing the same physical file):

  3. Command Help (man ln)
    The following options can be used:
© 2025  mtitek