modify basic filestructure

It's unclear what's 'basic', so `basic/` notes have been mostly moved.
The remainder became `shell/`.
This commit is contained in:
2026-04-20 02:42:41 +02:00
parent c95176c7a9
commit bca5337ac3
23 changed files with 2 additions and 445 deletions

38
system/hard_links.md Normal file
View File

@@ -0,0 +1,38 @@
---
title: "hard links"
tags: [ "basics", "links" ]
---
A hard link is one file which exists in multiple locations.
Each file has an ID, which is kept on the hard disk's partition.
Each hard link has the same ID, because they are the same file.
This ID is called the 'inode'.
Create a file, and a hard link:
```sh
fortune > $file_1
mkdir -p x/y/z/
ln $file_1 x/y/z/$file_2
```
Have a long look at the file with the `-l` flag, and check the inode with `-i`:
```sh
ls -li $file_1 x/y/z/$file_2
```
Since they are the same file, you can make a change to one, and it changes both:
```sh
fortune | tee x/y/z/$file_2
cat $file_1
cat x/y/z/$file_2
```
# Danger Zone
- hard links will not work on directories, only standard files and fifos.
- `git` will destroy and remake files, so it will not respect hard links.
- Files cannot have a hard link on another disk partition, because the inode is stored on each partition.