diff --git a/src/tools/screen-memo/index.ts b/src/tools/screen-memo/index.ts new file mode 100644 index 00000000..5ed5db79 --- /dev/null +++ b/src/tools/screen-memo/index.ts @@ -0,0 +1,13 @@ +import { ScreenShare } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Screen Command Cheatsheet', + path: '/screen-memo', + description: 'Screen linux command memo', + keywords: ['terminal', 'linux', 'shell', 'screen'], + component: () => import('./screen-memo.vue'), + icon: ScreenShare, + createdAt: new Date('2025-12-13'), + category: 'Cheatsheets', +}); diff --git a/src/tools/screen-memo/screen-memo.content.md b/src/tools/screen-memo/screen-memo.content.md new file mode 100644 index 00000000..5d1c367e --- /dev/null +++ b/src/tools/screen-memo/screen-memo.content.md @@ -0,0 +1,129 @@ +# 🖥️ GNU Screen Command Cheatsheet + +GNU Screen is a terminal multiplexer that lets you run multiple shell sessions inside a single terminal window, detach them, and reattach later. + +## 📦 Starting & Managing Screen Sessions + +- **Start a new session** + ```bash + screen + ``` +- **Start with a session name** + ```bash + screen -S session_name + ``` +- **List running sessions** + ```bash + screen -ls + ``` +- **Attach to a session** + ```bash + screen -r session_name + ``` +- **Attach to the last detached session** + ```bash + screen -r + ``` +- **Kill a session** + ```bash + screen -X -S session_name quit + ``` + +## ⌨️ Essential Key Bindings + +> Default prefix key: `Ctrl-a` (press before other keys) + +| Key Binding | Action | +|-|--| +| `Ctrl-a c` | Create new window | +| `Ctrl-a n` | Next window | +| `Ctrl-a p` | Previous window | +| `Ctrl-a "` | List all windows | +| `Ctrl-a 0..9` | Switch to window by number | +| `Ctrl-a A` | Rename current window | +| `Ctrl-a d` | Detach session | +| `Ctrl-a ?` | Help (show key bindings) | +| `Ctrl-a k` | Kill current window | +| `Ctrl-a \` | Kill all windows & exit screen | +| `Ctrl-a x` | Lock screen | +| `Ctrl-a S` | Split screen horizontally | +| `Ctrl-a |` | Split screen vertically | +| `Ctrl-a tab` | Switch focus between regions | +| `Ctrl-a Q` | Close all regions except current | + +## 🔀 Window & Region Management + +- **Split horizontally** + ```bash + Ctrl-a S + ``` +- **Split vertically** + ```bash + Ctrl-a | + ``` +- **Switch region focus** + ```bash + Ctrl-a tab + ``` +- **Remove all splits except current** + ```bash + Ctrl-a Q + ``` + +## 📂 Session Persistence + +- **Detach session (keep running in background)** + ```bash + Ctrl-a d + ``` +- **Reattach session** + ```bash + screen -r session_name + ``` + +## ⚙️ Configuration + +- **Default config file:** `~/.screenrc` +- Example `.screenrc`: + ```bash + # Start with a named session + startup_message off + defscrollback 5000 + hardstatus alwayslastline + hardstatus string '%{= kG}[%H] %{= kw}%?%-Lw%?%{= kR}%n*%f %t%?(%u)%?%{= kw}%?%+Lw%? %{= kG}[%H]' + ``` + +## 🛠️ Useful Options + +- **Scrollback buffer size** + ```bash + screen -h 5000 + ``` +- **Execute command in new screen** + ```bash + screen -dmS session_name command + ``` +- **Log output** + ```bash + Ctrl-a H + ``` + (toggle logging in current window) + +## 🚪 Exiting Screen + +- **Kill current window** + ```bash + Ctrl-a k + ``` +- **Kill all windows & quit** + ```bash + Ctrl-a \ + ``` +- **Exit normally** + - Close all programs in the window, then type `exit`. + +## 🧠 Tips + +- Use **named sessions** (`screen -S`) to avoid confusion. +- Combine with **SSH** to keep remote jobs running after disconnect. +- Use `.screenrc` to customize behavior and status line. \ No newline at end of file diff --git a/src/tools/screen-memo/screen-memo.vue b/src/tools/screen-memo/screen-memo.vue new file mode 100644 index 00000000..6320296b --- /dev/null +++ b/src/tools/screen-memo/screen-memo.vue @@ -0,0 +1,32 @@ + + + + + diff --git a/src/tools/tmux-memo/index.ts b/src/tools/tmux-memo/index.ts new file mode 100644 index 00000000..b50a79ed --- /dev/null +++ b/src/tools/tmux-memo/index.ts @@ -0,0 +1,13 @@ +import { ScreenShare } from '@vicons/tabler'; +import { defineTool } from '../tool'; + +export const tool = defineTool({ + name: 'Tmux Command Cheatsheet', + path: '/tmux-memo', + description: 'Tmux linux command memo', + keywords: ['terminal', 'linux', 'shell', 'tmux'], + component: () => import('./tmux-memo.vue'), + icon: ScreenShare, + createdAt: new Date('2025-12-13'), + category: 'Cheatsheets', +}); diff --git a/src/tools/tmux-memo/tmux-memo.content.md b/src/tools/tmux-memo/tmux-memo.content.md new file mode 100644 index 00000000..2702011a --- /dev/null +++ b/src/tools/tmux-memo/tmux-memo.content.md @@ -0,0 +1,57 @@ +# 🖥️ tmux Linux Command Cheatsheet + +## 🔑 Basics +- **Start new session**: `tmux` +- **Start named session**: `tmux new -s ` +- **List sessions**: `tmux ls` +- **Attach to last session**: `tmux attach` +- **Attach to named session**: `tmux attach -t ` +- **Detach from session**: `Ctrl+b d` +- **Kill session**: `tmux kill-session -t ` +- **Rename session**: `Ctrl+b $` + +## 📂 Windows (like tabs) +- **Create new window**: `Ctrl+b c` +- **Rename window**: `Ctrl+b ,` +- **Next window**: `Ctrl+b n` +- **Previous window**: `Ctrl+b p` +- **List windows**: `Ctrl+b w` +- **Switch to window #**: `Ctrl+b <0-9>` +- **Kill current window**: `Ctrl+b &` + +## 🪟 Panes (splits) +- **Split vertically**: `Ctrl+b %` +- **Split horizontally**: `Ctrl+b "` +- **Move between panes**: `Ctrl+b ` +- **Cycle panes**: `Ctrl+b o` +- **Toggle pane zoom**: `Ctrl+b z` +- **Kill pane**: `Ctrl+b x` +- **Swap panes**: `Ctrl+b {` (swap with previous), `Ctrl+b }` (swap with next) + +## 📋 Copy Mode +- **Enter copy mode**: `Ctrl+b [` +- **Start selection**: `` +- **Copy selection**: `` +- **Quit copy mode**: `q` +- **Paste buffer**: `Ctrl+b ]` + +## ⚙️ Configuration +- **Reload config**: `tmux source-file ~/.tmux.conf` +- **Show options**: `tmux show-options -g` +- **List all shortcuts**: `Ctrl+b ?` + +## 🧭 Useful Commands +- **Command prompt**: `Ctrl+b :` +- **List sessions/windows/panes**: `tmux info` +- **Kill server (all sessions)**: `tmux kill-server` + +## 📝 Notes +- **Prefix key**: Default is `Ctrl+b`. Press it before any shortcut. +- **Custom prefix**: Can be changed in `~/.tmux.conf` (e.g., `set -g prefix C-a`). + +### Example Workflow +1. Start a named session: `tmux new -s dev` +2. Split into panes: `Ctrl+b %` and `Ctrl+b "` +3. Create multiple windows: `Ctrl+b c` +4. Detach: `Ctrl+b d` +5. Reattach later: `tmux attach -t dev` \ No newline at end of file diff --git a/src/tools/tmux-memo/tmux-memo.vue b/src/tools/tmux-memo/tmux-memo.vue new file mode 100644 index 00000000..479c4ec1 --- /dev/null +++ b/src/tools/tmux-memo/tmux-memo.vue @@ -0,0 +1,32 @@ + + + + +