mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-22 22:02:38 +03:00
1 parent
209988a3f2
commit
20c0791fc6
6 files changed
+276
No files matched your search
@@ -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',
|
||||||
|
});
|
||||||
@@ -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.
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useThemeVars } from 'naive-ui';
|
||||||
|
import Memo from './screen-memo.content.md';
|
||||||
|
|
||||||
|
const themeVars = useThemeVars();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Memo />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
::v-deep(pre) {
|
||||||
|
margin: 0;
|
||||||
|
padding: 15px 22px;
|
||||||
|
background-color: v-bind('themeVars.cardColor');
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
::v-deep(table) {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
::v-deep(table), ::v-deep(td), ::v-deep(th) {
|
||||||
|
border: 1px solid v-bind('themeVars.textColor1');
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
::v-deep(a) {
|
||||||
|
color: v-bind('themeVars.textColor1');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -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',
|
||||||
|
});
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
# 🖥️ tmux Linux Command Cheatsheet
|
||||||
|
|
||||||
|
## 🔑 Basics
|
||||||
|
- **Start new session**: `tmux`
|
||||||
|
- **Start named session**: `tmux new -s <name>`
|
||||||
|
- **List sessions**: `tmux ls`
|
||||||
|
- **Attach to last session**: `tmux attach`
|
||||||
|
- **Attach to named session**: `tmux attach -t <name>`
|
||||||
|
- **Detach from session**: `Ctrl+b d`
|
||||||
|
- **Kill session**: `tmux kill-session -t <name>`
|
||||||
|
- **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 <arrow keys>`
|
||||||
|
- **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**: `<Space>`
|
||||||
|
- **Copy selection**: `<Enter>`
|
||||||
|
- **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`
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { useThemeVars } from 'naive-ui';
|
||||||
|
import Memo from './tmux-memo.content.md';
|
||||||
|
|
||||||
|
const themeVars = useThemeVars();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<Memo />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
::v-deep(pre) {
|
||||||
|
margin: 0;
|
||||||
|
padding: 15px 22px;
|
||||||
|
background-color: v-bind('themeVars.cardColor');
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
::v-deep(table) {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
::v-deep(table), ::v-deep(td), ::v-deep(th) {
|
||||||
|
border: 1px solid v-bind('themeVars.textColor1');
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
::v-deep(a) {
|
||||||
|
color: v-bind('themeVars.textColor1');
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Reference in new issue
Block a user