The note is generated by “chatGPT”.
当希望 A 服务器借用 B 服务器的代理网络(例如 Clash/Mihomo 的 7890 端口)时,可以使用 SSH 的端口转发(ssh -L)来实现。
最终效果是:
A 访问 127.0.0.1:本地端口 → 通过 SSH 转发到 B:7890 → B 的 Clash 提供代理功能
1️⃣ 前提条件
A 可以 SSH 登录 B
The note is generated by “ChatGPT”.
🔹 source
- Executes a script in the current shell environment.
- Does not create a new shell process.
- All variable exports, alias definitions, and PATH modifications remain active after execution.
- Commonly used for reloading configuration files (e.g.,
source ~/.bashrc). - Bash and Zsh built-in command.
Example:
| |
→ Reloads your Bash configuration immediately in the current session.
🔹 bash
- Starts a new Bash subshell to run the script.
- The parent shell does not inherit any environment changes.
- Safer for running scripts that should not affect your current session.
- Suitable for installation, automation, or isolated execution.
Example:
The note is generated by “DeepSeek”.
一、基础设置步骤
1. 生成 SSH 密钥对(客户端)
| |
2. 复制公钥到服务器
方法一:使用 ssh-copy-id(推荐)
Here’s a cheat sheet of “10 Terminal Tricks Most Developers Don’t Know (But Should)” by Rishabh Agarwal: Level Up Coding
🔍 Command History & Navigation
| Shortcut / Command | Description |
|---|---|
Ctrl + R | Reverse-search previously used commands from history. |
!! | Re-run the last executed command. |
cd - | Switch back to the previous directory. |
🧭 Cursor Movement
| Shortcut | Description |
|---|---|
Ctrl + A | Jump to the start of the current command line. |
Ctrl + E | Jump to the end of the current command line. |
Alt + ← / → | Move the cursor word-by-word (instead of character-by-character). |
✂️ Editing Commands
| Shortcut | Description |
|---|---|
Ctrl + U | Delete from cursor to the start of the line. |
Ctrl + K | Delete from cursor to the end of the line. |
⚡ Autocomplete & Suggestions
| Shortcut | Description |
|---|---|
<Tab> <Tab> | Show all possible command or path completions. |
🧹 Utility
| Shortcut | Description |
|---|---|
Ctrl + L | Clear the terminal screen instantly. |
📘 Overview
On Linux, the command-line tool trash-cli provides a safe alternative to rm, allowing you to move files to the Trash instead of permanently deleting them.
It fully complies with the FreeDesktop Trash Specification, which is used by desktop environments such as GNOME and KDE.
🧰 Installation
You can install trash-cli using your package manager or Python’s pip:
| |
🚫 Disable rm (for safety)
To avoid accidental permanent deletions, you can override the rm command and display a friendly warning instead.
The note is generated by chatGPT.
🌟 在 Linux 服务器上用 root 配置 Clash 服务
🪶 1. 创建目录并放置文件
| |
设置权限(root 拥有,程序可执行):
- linux上的垃圾桶: trash-cli
- 安装
sudo apt install trash-cli 或 pip install trash-cli - 取消"rm":
alias rm='echo " ⚠️ This is not the command you are looking for.👉 Please use trash-cli instead. It is safer and provides these commands:
trash-put / trash → Move files/directories to trash
trash-empty → Empty the trashcan(s)
trash-list → List trashed files
trash-restore → Restore a trashed file
trash-rm → Remove individual files from trash
"'
- 安装