# Symbolic Links

UNIX filesystems have a feature called symbolic links, which are files that point to another file, called the target. They're similar to shortcuts in Windows.

There are two kinds of symbolic links: hard links and soft links.

## Hard Links

Hard links create a file which points to the same space on the hard drive as the file which is being linked to, rather than to that file itself.

```
/home/me/file      /home/you/file
    |                    |
 hard link           hard link
    |                   ,'
    V               _.-`
HARD DRIVE <....--``
```

A file won't be deleted until every hard link to it is deleted.

To create a hard link, you use the `ln` command with the source file, and the target hard linked file:

```bash
ln arrayDat.txt arrayHard.txt

ls
```

Notice that any changes you make to `arrayDat.txt` will be reflected in `arrayHard.txt`.

## Soft Links

Soft links create a file which points to the original file or directory.

```
/home/me/file <---Soft link--- /home/you/file
     |
     |
     V
HARD DRIVE
```

Soft links break if the original file is deleted.

To create a soft link, you use the `ln` command with the `-s` flag.

```bash
ln -s arrayDat.txt arraySoft.txt

ls -l
```

Notice that any changes you make to `arrayDat.txt` will be reflected in `arraySoft.txt`. The `ls` command will show that `arraySoft.txt` points to the file `arrayDat.txt`.

Your Luria home folder has a couple of soft links automatically set up pointing to storage servers so that common programs don't take up too much space on the head node.

[#home-directory](https://igb.mit.edu/computing-resources/luria-cluster#home-directory "mention")


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://igb.mit.edu/mini-courses/introduction-to-unix/files/symbolic-links.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
