2025-12-08
SSH转发让A server使用B server的代理
2025-12-08 ~ 2025-12-08

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

2025-11-07
Shell execution commands — source bash and dot
2025-11-07 ~ 2025-11-07

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:

1
source ~/.bashrc

→ 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:

2025-11-07
SSH自动登录与debug
2025-11-07 ~ 2025-11-07


The note is generated by “DeepSeek”.

一、基础设置步骤

1. 生成 SSH 密钥对(客户端)

1
2
ssh-keygen -t rsa -b 4096
# 默认保存位置:~/.ssh/id_rsa (私钥) 和 ~/.ssh/id_rsa.pub (公钥)

2. 复制公钥到服务器

方法一:使用 ssh-copy-id(推荐)

2025-10-23
10 Terminal Tricks
2025-10-23 ~ 2026-01-01

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 / CommandDescription
Ctrl + RReverse-search previously used commands from history.
!!Re-run the last executed command.
cd -Switch back to the previous directory.

🧭 Cursor Movement

ShortcutDescription
Ctrl + AJump to the start of the current command line.
Ctrl + EJump to the end of the current command line.
Alt + ← / →Move the cursor word-by-word (instead of character-by-character).

✂️ Editing Commands

ShortcutDescription
Ctrl + UDelete from cursor to the start of the line.
Ctrl + KDelete from cursor to the end of the line.

⚡ Autocomplete & Suggestions

ShortcutDescription
<Tab> <Tab>Show all possible command or path completions.

🧹 Utility

ShortcutDescription
Ctrl + LClear the terminal screen instantly.
2025-10-23
Trash-cli — The Recycle Bin on Linux
2025-10-23 ~ 2025-10-23

📘 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:

1
2
3
sudo apt install trash-cli
# or
pip install trash-cli

🚫 Disable rm (for safety)

To avoid accidental permanent deletions, you can override the rm command and display a friendly warning instead.

2025-10-22
Root配置全体用户均可用的代理
2025-10-22 ~ 2025-10-22

The note is generated by chatGPT.

🌟 在 Linux 服务器上用 root 配置 Clash 服务


🪶 1. 创建目录并放置文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
sudo mkdir -p /opt/mihomo
cd /opt/mihomo


将clash for linux的相关文件移动到/opt/mihomo:
/opt/mihomo/
├── clash-linux        # 主程序(可执行文件)
├── config.yaml        # 配置文件
├── Country.mmdb       # 国家数据库
├── GeoIP.dat          # IP 地理数据库
├── GeoSite.dat        # 网站分类数据库
├── cache.db           # 可选缓存文件

设置权限(root 拥有,程序可执行):

2025-10-17
Linux上好用的工具
2025-10-17 ~ 2025-10-17
  • linux上的垃圾桶: trash-cli
    1. 安装
      sudo apt install trash-cli
      或
      pip install trash-cli
      
    2. 取消"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
      "'