diff --git a/Linux/BASH Skripte/Zugriff auf den Skript-Pfad in BASH.md b/Linux/BASH Skripte/Zugriff auf den Skript-Pfad in BASH.md index 70e985f..d0ee298 100644 --- a/Linux/BASH Skripte/Zugriff auf den Skript-Pfad in BASH.md +++ b/Linux/BASH Skripte/Zugriff auf den Skript-Pfad in BASH.md @@ -1,3 +1,7 @@ +## Einzeiler +```bash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +``` ## Grundlegende Methoden ### 1. Einfache Variante mit `$0` diff --git a/Linux/Hacks.md b/Linux/Hacks.md new file mode 100644 index 0000000..e475b98 --- /dev/null +++ b/Linux/Hacks.md @@ -0,0 +1,16 @@ +Effortless Folder Creation: You can create multiple directory combinations at once by using `mkdir -p` followed by the directory path with sections in curly braces. For example, +```bash +mkdir -p ./home/{a,b}/{x,y,z}. +``` + + +Backtrack Fast: Instead of repeatedly typing `cd ..` to go back, simply use `cd -` to return to your previous directory immediately. + + +Bulk File Generation: Create a large range of numbered files in seconds using the touch command with braces. For example, `touch file{1..100}.txt` will instantly create 100 text files. + + +Real-time Log Monitoring: To watch a log file as it updates, use `tail -f [filename]`. The `-f` flag "follows" the file, so you see new lines of data as they are added in real-time. + + +Quick Command History: If you need to see your most recent actions, use history followed by a number (e.g., `history 5`) to display exactly that many of your last commands. \ No newline at end of file diff --git a/Linux/Meine Config.md b/Linux/Meine Config.md index 7b06901..28ae26b 100644 --- a/Linux/Meine Config.md +++ b/Linux/Meine Config.md @@ -1,3 +1,3 @@ * [[ssh Key erstellen]] -* [[mein fstab]] +* [[fstab]] * \ No newline at end of file diff --git a/Linux/Yazi.md b/Linux/Yazi.md new file mode 100644 index 0000000..d2ada62 --- /dev/null +++ b/Linux/Yazi.md @@ -0,0 +1,174 @@ +# Quick Start + +Once you've [installed Yazi](https://yazi-rs.github.io/docs/installation), start the program with: + +``` +yazi +``` + +Press q to quit, F1 or ~ to open the help menu. + +## Shell wrapper + +We suggest using this `y` shell wrapper that provides the ability to change the current working directory when exiting Yazi. + +- Bash / Zsh +- Fish +- Nushell +- POSIX +- Elvish +- PowerShell +- Command Prompt +- Xonsh + +``` +function y() { local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd command yazi "$@" --cwd-file="$tmp" IFS= read -r -d '' cwd < "$tmp" [ "$cwd" != "$PWD" ] && [ -d "$cwd" ] && builtin cd -- "$cwd" rm -f -- "$tmp"} +``` + +To use it, copy the function into the configuration file of your respective shell. + +Then use `y` instead of `yazi` to start, and press q to quit, you'll see the CWD changed. Sometimes, you don't want to change, press Q to quit. + +## Keybindings + +tip + +For all keybindings, see the [default `keymap.toml` file](https://github.com/sxyazi/yazi/blob/shipped/yazi-config/preset/keymap-default.toml). + +### Navigation + +To navigate between files and directories you can use the arrow keys ←, ↓, ↑ and → or Vim-like keys such as h, j, k, l: + +|Key binding|Alternate key|Action| +|---|---|---| +|k|↑|Move the cursor up| +|j|↓|Move the cursor down| +|l|→|Enter hovered directory| +|h|←|Leave the current directory and into its parent| + +Further navigation commands can be found in the table below. + +|Key binding|Action| +|---|---| +|K|Seek up 5 units in the preview| +|J|Seek down 5 units in the preview| +|g ⇒ g|Move cursor to the top| +|G|Move cursor to the bottom| +|z|[Cd](https://yazi-rs.github.io/docs/configuration/keymap#mgr.cd) to a directory or [reveal](https://yazi-rs.github.io/docs/configuration/keymap#mgr.reveal) a file via fzf| +|Z|[Cd](https://yazi-rs.github.io/docs/configuration/keymap#mgr.cd) to a directory via zoxide| +|g ⇒ Space|[Cd](https://yazi-rs.github.io/docs/configuration/keymap#mgr.cd) to a directory or [reveal](https://yazi-rs.github.io/docs/configuration/keymap#mgr.reveal) a file via interactive prompt| + +### Selection + +To select files and directories, the following commands are available. + +|Key binding|Action| +|---|---| +|Space|Toggle selection of hovered file/directory| +|v|Enter visual mode (selection mode)| +|V|Enter visual mode (unset mode)| +|Ctrl + a|Select all files| +|Ctrl + r|Inverse selection of all files| +|Esc|Cancel selection| + +### File operations + +To interact with selected files/directories use any of the commands below. + +|Key binding|Action| +|---|---| +|o|Open selected files| +|O|Open selected files interactively| +|Enter|Open selected files| +|Shift + Enter|Open selected files interactively (some terminals don't support it yet)| +|Tab|Show the file information| +|y|Yank selected files (copy)| +|x|Yank selected files (cut)| +|p|Paste yanked files| +|P|Paste yanked files (overwrite if the destination exists)| +|Y or X|Cancel the yank status| +|d|Trash selected files| +|D|Permanently delete selected files| +|a|Create a file (ends with / for directories)| +|r|Rename selected file(s)| +|.|Toggle the visibility of hidden files| + +Further file operation commands can be found in the table below. + +|Key binding|Action| +|---|---| +|;|Run a shell command| +|:|Run a shell command (block until finishes)| +|-|Symlink the absolute path of yanked files| +|_|Symlink the relative path of yanked files| +|Ctrl + -|Hardlink yanked files| + +### Copy paths + +To copy paths, use any of the following commands below. + +_Observation: c ⇒ d indicates pressing the c key followed by pressing the d key._ + +|Key binding|Action| +|---|---| +|c ⇒ c|Copy the file path| +|c ⇒ d|Copy the directory path| +|c ⇒ f|Copy the filename| +|c ⇒ n|Copy the filename without extension| + +### Filter files + +|Key binding|Action| +|---|---| +|f|Filter files| + +### Find files + +|Key binding|Action| +|---|---| +|/|Find next file| +|?|Find previous file| +|n|Go to the next found| +|N|Go to the previous found| + +### Search files + +|Key binding|Action| +|---|---| +|s|Search files by name using [fd](https://github.com/sharkdp/fd)| +|S|Search files by content using [ripgrep](https://github.com/BurntSushi/ripgrep)| +|Ctrl + s|Cancel the ongoing search| + +### Sorting + +To sort files/directories use the following commands. + +_Observation: , ⇒ a indicates pressing the , key followed by pressing the a key._ + +|Key binding|Action| +|---|---| +|, ⇒ m|Sort by modified time| +|, ⇒ M|Sort by modified time (reverse)| +|, ⇒ b|Sort by birth time| +|, ⇒ B|Sort by birth time (reverse)| +|, ⇒ e|Sort by file extension| +|, ⇒ E|Sort by file extension (reverse)| +|, ⇒ a|Sort alphabetically| +|, ⇒ A|Sort alphabetically (reverse)| +|, ⇒ n|Sort naturally| +|, ⇒ N|Sort naturally (reverse)| +|, ⇒ s|Sort by size| +|, ⇒ S|Sort by size (reverse)| +|, ⇒ r|Sort randomly| + +### Multi-tab + +|Key binding|Action| +|---|---| +|t|Create a new tab with CWD| +|1, 2, ..., 9|Switch to the N-th tab| +|[|Switch to the previous tab| +|]|Switch to the next tab| +|{|Swap current tab with previous tab| +|}|Swap current tab with next tab| +|Ctrl + c|Close the current tab| \ No newline at end of file diff --git a/Linux/fstab.md b/Linux/fstab.md new file mode 100644 index 0000000..df14302 --- /dev/null +++ b/Linux/fstab.md @@ -0,0 +1,106 @@ +# 🧭 Übersicht: `/etc/fstab` – Netzlaufwerke & SSHFS + +Diese Datei enthält Einträge für automatisch eingehängte Netzlaufwerke. +Wichtig: Teste Änderungen **immer** mit +```bash +sudo mount -a +``` +um Syntaxfehler zu erkennen, bevor du neustartest. +→ siehe [[fstab Grundlagen]] + +--- + +## 🗂️ NAS-Laufwerke via NFS + +```fstab +192.168.0.14:/volume1/Gemeinsam /mnt/nas/gemeinsam nfs nfsvers=3,rw,_netdev,noac,actimeo=0 0 0 +``` + +**Annahmen:** +- NAS-IP: `192.168.0.14` +- Freigabe (Quelle): `/volume1/Gemeinsam` +- Lokaler Mountpoint (Ziel): `/mnt/nas/gemeinsam` + +**Erläuterung der Optionen:** +- `nfsvers=3` → nutzt NFSv3 (älter, aber oft stabiler bei Synology) +- `rw` → Schreib-/Lesezugriff +- `_netdev` → mountet erst, wenn Netzwerk verfügbar ist +- `noac` → deaktiviert Client-Caching (nützlich bei Dateisynchronisierung, kann Performance senken) +- `actimeo=0` → setzt Cache-Timeout auf 0 (Dateiattribute werden immer neu gelesen) + +👉 siehe [[NFS unter Linux]] und [[NFS Mount Optionen]] + +💡 *Tipp:* +Bei neueren Systemen oder stabilen Netzwerken ist `nfsvers=4` meist die bessere Wahl. Beispiel: +```fstab +192.168.0.14:/volume1/Gemeinsam /mnt/nas/gemeinsam nfs nfsvers=4,rw,_netdev 0 0 +``` + +📦 **Benötigtes Paket (Debian/Ubuntu):** +```bash +sudo apt install nfs-common +``` +→ siehe [[NFS Client Installation]] + +--- + +## ☁️ HiDrive via SFTP (SSHFS) + +```fstab +mathias2784@sftp.hidrive.strato.com:/users/mathias2784 /mnt/hidrive fuse.sshfs defaults,_netdev,IdentityFile=/home/mathias/.ssh/id_ed25519,allow_other 0 0 +``` + +**Erläuterung der Optionen:** +- `fuse.sshfs` → nutzt das FUSE-Modul für SSHFS +- `_netdev` → warte auf Netzwerk +- `IdentityFile=...` → Pfad zum SSH-Key +- `allow_other` → erlaubt Zugriff auch für andere Nutzer (Achtung: [[SSHFS Sicherheit]]) + +👉 siehe [[SSHFS unter Linux]] und [[HiDrive Konfiguration]] + +💡 *Tipp:* +Füge optional `reconnect,ServerAliveInterval=15,ServerAliveCountMax=3` hinzu, damit die Verbindung stabil bleibt: +```fstab +mathias2784@sftp.hidrive.strato.com:/users/mathias2784 /mnt/hidrive fuse.sshfs _netdev,IdentityFile=/home/mathias/.ssh/id_ed25519,allow_other,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3 0 0 +``` + +📦 **Benötigtes Paket (Debian/Ubuntu):** +```bash +sudo apt install sshfs +``` +→ siehe [[SSHFS Installation]] + +--- + +## 🖥️ "Schneiderserver" via SSHFS + +```fstab +root@schneiderserver.site:/root /mnt/strato_vm fuse.sshfs _netdev,IdentityFile=/home/mathias/.ssh/id_ed25519_strato_vm,allow_other 0 0 +``` + +**Optionen wie oben**, jedoch: +- Zugriff als `root` nur wenn zwingend notwendig (besser: Benutzer mit begrenzten Rechten) +- Key-File ggf. mit restriktiven Rechten (`chmod 600`) + +👉 siehe [[SSH Sicherheit]] und [[Root via SSH vermeiden]] + +📦 **Benötigtes Paket (Debian/Ubuntu):** +```bash +sudo apt install sshfs +``` + +--- + +## ✅ Allgemeine Hinweise + +- Testen: `sudo mount -a` +- Mounten einzelner Einträge: + ```bash + sudo mount /mnt/hidrive + ``` +- Logs prüfen bei Problemen: + ```bash + sudo journalctl -xe | grep sshfs + ``` + +Weitere Themen: [[fstab Optionen Übersicht]], [[Mount Fehlerbehebung]], [[Systemd Automounts]] \ No newline at end of file diff --git a/privat/fstab.buntes_monster.md b/privat/fstab.buntes_monster.md new file mode 100644 index 0000000..aa11d68 --- /dev/null +++ b/privat/fstab.buntes_monster.md @@ -0,0 +1,24 @@ +```bash +# /etc/fstab: static file system information. +# +# Use 'blkid' to print the universally unique identifier for a +# device; this may be used with UUID= as a more robust way to name devices +# that works even if disks are added and removed. See fstab(5). +# +# +# / was on /dev/nvme0n1p2 during installation +UUID=4d4554dc-e3fc-499c-991c-074655585d11 / ext4 errors=remount-ro 0 1 +# /boot/efi was on /dev/nvme0n1p1 during installation +UUID=FCBD-00BE /boot/efi vfat umask=0077 0 1 +/swapfile none swap sw 0 0 +UUID=04F6962EF6961FCA /mnt/anbau ntfs-3g defaults,umask=000,uid=1000,gid=1000 0 0 +UUID=A8F0EC77F0EC4D5E /mnt/bilder ntfs-3g defaults,umask=000,uid=1000,gid=1000 0 0 +UUID=5a603e70-aa52-405a-b86c-6b4def8d438f /mnt/spielplatz ext4 defaults 0 0 +UUID=a642b8a8-2cdd-4635-a094-e408073a236d /mnt/mathieu ext4 defaults 0 2 +#//192.168.0.14/Mathias /mnt/nas/mathias cifs credentials=/etc/secret.mathias.nas.smb,iocharset=utf8,uid=1000,gid=1000 0 0 +#//192.168.0.14/Gemeinsam /mnt/nas/gemeinsam cifs credentials=/etc/secret.mathias.nas.smb,iocharset=utf8,uid=1000,gid=1000 0 0 +192.168.0.14:/volume1/Mathias /mnt/nas/mathias nfs nfsvers=3,rw,_netdev,noac,actimeo=0 0 0 +192.168.0.14:/volume1/Gemeinsam /mnt/nas/gemeinsam nfs nfsvers=3,rw,_netdev,noac,actimeo=0 0 0 +mathias2784@sftp.hidrive.strato.com:/users/mathias2784 /mnt/hidrive fuse.sshfs defaults,_netdev,IdentityFile=/home/mathias/.ssh/id_ed25519,allow_other 0 0 +root@schneiderserver.site:/root /mnt/strato_vm fuse.sshfs _netdev,IdentityFile=/home/mathias/.ssh/id_ed25519_strato_vm,allow_other 0 0 +```