Submitted by admin on 2026, May 27, 8:53 AM
Window:
ctrl+b, C创建一个新的窗口(下方会出来)
ctrl+b, 0/1/2切换
ctrl+b, P上一个/N下一个
ctrl+b, & kill
Pane:
ctrl+b, %, 左右分割窗口
Ctrl+b," 上写分割窗口
Ctrl+b, 上下左右 切换这些窗口
Ctrl+b, X退出小串口
Ctrl+b, Z放大小窗口,再来一次恢复
ctrl+b, W可以监控所有窗口
这是 tmux 自带的滚动方案,无需任何配置,所有环境都能直接使用:
按 Prefix + [ 进入复制 / 滚动模式(此时终端底部会出现行号提示)
滚动操作:
逐行滚动:方向键 ↑/↓
整页翻页:PageUp/PageDown
Vi 模式:可用 k/j 逐行、Ctrl+u/Ctrl+d 半页翻页
Emacs 模式:可用 Ctrl+p/Ctrl+n 逐行滚动
退出滚动模式:按 q 即可回到正常终端交互模式
linux | 评论:0
| Trackbacks:0
| 阅读:124
Submitted by admin on 2026, May 8, 1:09 PM
apt install postgresql postgresql-contrib
sudo -u postgres psql
GRANT ALL PRIVILEGES ON DATABASE app_db TO app_user;
ALTER DATABASE app_db OWNER TO app_user;
CREATE DATABASE app_db OWNER app_user;
\l # 查看数据库及其所有者
\du # 列出所有数据库用户及其角色属性
连接到数据库:
\c mydatabase
列出当前数据库的所有表:
\dt
列出所有用户
\du
创建用户并设置密码
CREATE USER postgres WITH PASSWORD 'your_password';
3.8 修改指定用户的密码
ALTER USER username WITH PASSWORD 'new_password';
备份数据库并包含创建数据库命令:
pg_dump -U postgres -h localhost -p 5432 -F c -b -v -C -f /path/to/backup/aibox_cloud.backup mydatabase
参数解释:
pg_dump:用于备份 PostgreSQL 数据库的工具。
-U postgres:指定数据库用户名为 postgres。
-h localhost:指定数据库服务器的主机名为 localhost。
-p 5432:指定数据库服务器的端口号为 5432。
-F c:指定备份文件格式为自定义格式(custom)。这种格式支持压缩和并行恢复。
-b:包含大对象(blobs)在备份中。
-v:启用详细模式,显示备份过程中的详细信息(verbose)。
-C:在备份文件中包含创建数据库的命令(--create)。
-f /path/to/backup/aibox_cloud.backup:指定输出备份文件的路径和文件名为 /path/to/backup/aibox_cloud.backup。
mydatabase:要备份的数据库名。
5.恢复包含创建数据库命令的备份文件:
pg_restore -U postgres -h localhost -p 5432 -C -d postgres -v /path/to/backup/aibox_cloud.backup
参数解释:
pg_restore:用于恢复由 pg_dump 创建的备份文件的工具。
-U postgres:指定数据库用户名为 postgres。
-h localhost:指定数据库服务器的主机名为 localhost。
-p 5432:指定数据库服务器的端口号为 5432。
-C:在恢复过程中创建数据库。如果备份文件中包含了创建数据库的命令(--create)。
-d postgres:指定连接的目标数据库。在使用 -C 选项时,这个数据库仅用作连接,并在其中执行创建和恢复新数据库的操作。通常使用默认的 postgres 数据库。
-v:启用详细模式,显示恢复过程中的详细信息(verbose)。
/path/to/backup/aibox_cloud.backup:要恢复的备份文件的路径和文件名。
linux | 评论:0
| Trackbacks:0
| 阅读:179
Submitted by admin on 2026, May 2, 9:33 AM
npm i web-git-viewer
# View the current directory (must be a git repo)
npx web-git-viewer
# View specific repositories
npx web-git-viewer /path/to/repo1 /path/to/repo2
# Custom port
npx web-git-viewer -p 3000
# Password-protect the viewer
npx web-git-viewer --password mysecret
# Combine — cwd is auto-added if it's a git repo
npx web-git-viewer -p 8080 --password mysecret /path/to/other-repo
nodejs | 评论:0
| Trackbacks:0
| 阅读:172
Submitted by admin on 2026, April 26, 3:36 PM
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
apt install python3-venv
python3 -m venv myenv
source myenv/bin/activate
pytyon | 评论:0
| Trackbacks:0
| 阅读:191
Submitted by admin on 2026, April 16, 5:28 PM
systemctl list-unit-files --type=service --state=enabled
systemctl is-enabled name
linux | 评论:0
| Trackbacks:0
| 阅读:209
Submitted by admin on 2026, April 16, 5:18 PM
On Debian, iptables is a command-line utility for configuring packet filtering, NAT, and firewall rules. Since Debian 10 (Buster), the default backend is nftables via the iptables-nft compatibility layer, but you can still use the traditional syntax.
Installing iptables
If not already installed:
sudo apt update
sudo apt install iptables -y
You can check the current rules with:
sudo iptables -L
This lists the INPUT, FORWARD, and OUTPUT chains with their policies and rules .
Adding Rules
To allow incoming SSH traffic on port 22:
sudo iptables -A INPUT -i eth0 -p tcp --dport 22 -j ACCEPT
To allow HTTP/HTTPS:
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT
To drop all other inbound traffic:
sudo iptables -A INPUT -j REJECT
sudo iptables -A FORWARD -j REJECT
You can view detailed rules with:
sudo iptables -L -n -v
Saving Rules Permanently
By default, iptables rules are lost after reboot. To persist them:
Using iptables-persistent package:
sudo apt install iptables-persistent
sudo sh -c '/sbin/iptables-save > /etc/iptables/rules.v4'
sudo sh -c '/sbin/ip6tables-save > /etc/iptables/rules.v6'
Ensure the service is enabled:
sudo systemctl enable netfilter-persistent.service
Manual restore on boot: Create /etc/network/if-pre-up.d/iptables:
#!/bin/sh
/sbin/iptables-restore < /etc/iptables.up.rules #/etc/iptables/rules.v4 可以注释不用也不影响
Make it executable:
sudo chmod +x /etc/network/if-pre-up.d/iptables
Switching Between nftables and Legacy
If you need legacy iptables instead of nftables backend:
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
Switch back to nftables:
sudo update-alternatives --set iptables /usr/sbin/iptables-nft
Tip: Always test new firewall rules in a separate SSH session to avoid locking yourself out.
linux | 评论:0
| Trackbacks:0
| 阅读:208
Submitted by admin on 2026, April 16, 4:23 PM
一、编辑/etc/vim/vimrc.tiny
由于/etc/vim/vimrc.tiny的拥有者是root用户,所以要在root的权限下对这个文件进行修改。方法很简单:可以输入命令“su”,然后键入密码获得root权限,然后对文件进行修改;或者输入命令“sudo vi/etc/vim/vimrc.tiny”,输入密码后直接对文件进行编辑。
至于编辑的内容也是超级简单:vimrc.tiny文件中的倒数第二句话是“set compatible”,
将“compatible”改为“nocompatible”,这样非兼容模式就可以解决方向键变ABCD的问题了。
二、set backspace=2
那么接下来要解决Backspace键的问题也非常简单,就在刚才那句话的后面加一句:
set backspace=2
即:
set nocompatible
set backspace=2
ls时目录文件均没有颜色
~/.bashrc
alias ls='ls --color=auto'
vim /etc/vim/vimrc
取消“syntax on”的注释
或
cat .vimrc
syntax on
colorscheme desert
没有主题或颜色或没有vim,apt install vim
linux | 评论:0
| Trackbacks:0
| 阅读:217
Submitted by admin on 2026, March 20, 11:54 AM
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"dangerouslyDisableDeviceAuth":true,
disconnected (4008): connect failed
"controlUi": {
"enabled": true,
"allowInsecureAuth": true,
"dangerouslyDisableDeviceAuth": true
}
openclaw | 评论:0
| Trackbacks:0
| 阅读:304