Soft Link and Hard Link
Soft Link and Hard Link
Soft links (symbolic links) and hard links are two types of links used in file systems to
associate one file with another. Both types of links are ways to create references to files,
but they have different characteristics and use cases
• Definition:
A soft link is a pointer or reference to another file or directory. It is a separate file that
contains a path to the target file or directory.
• Characteristics:
o The size of a soft link is typically small, as it only contains the path to the target file.
o If the target file is deleted or moved, the soft link becomes a "dangling link" and will no
longer point to a valid location.
• Soft links can span file systems, allowing links to files or directories located on different
partitions.
• They can link to non-existent targets without causing errors.
Hard Link:
• Definition:
A hard link is an additional reference to an existing inode (data structure on disk
representing a file). Hard links essentially share the same data blocks on the disk with the
original file.
• Characteristics:
o All hard links to a file are essentially equal; there is no concept of the "original" file.
o Deleting any hard link does not affect the other links as long as there is at least one
remaining.
o Hard links cannot span file systems; all links must be on the same partition or disk.
o Changing the content of any link affects all other links since they point to the same data
blocks.
For example: ln /path/to/target_file /path/to/hard_link
To verify the link type and see where the link points, you can use the dir command
with the /a option:
dir /a C:\LinkToFolder
dir /a C:\LinkToFile.txt
Wildcard
Wildcards in operating systems are characters or combinations of characters that represent
unknown or multiple characters in file and directory names. They are used with commands
to perform operations on groups of files that match a specific pattern. Wildcards provide a
convenient way to work with multiple files without specifying each file's exact name. Here
are some common wildcards used in various operating systems:
Example:
file?.txt matches files like "file1.txt," "fileA.txt," etc., where "?" represents a single
character.
3.. Square Brackets ([ ]) - Match any single character within the specified
range or set
Example:
[abc]file.txt matches "afile.txt," "bfile.txt," or "cfile.txt."
[0-9]file.txt matches any single digit followed by "file.txt."