抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

Linux小记

记录一些针对于Linux的操作指令,服务器/开发机等

服务器上CentOS的一些指令

防火墙

使用系统指令

1
2
3
4
5
6
7
systemctl start firewalld #开启
systemctl stop firewalld #关闭
systemctl restart firewalld #重启
systemctl reload firewalld #重新加载
systemctl status firewalld #查看状态
systemctl enable firewalld #设置开机自启动
systemctl disable firewalld #取消开机自启动

使用firewall-cmd指令

1
2
3
4
5
6
7
8
9
firewall-cmd --state #查看状态
firewall-cmd --reload #重新加载
firewall-cmd --add-port=80/tcp --permanent #永久添加端口
firewall-cmd --list-ports #查看端口
firewall-cmd --list-all #查看所有规则
firewall-cmd --list-services #查看所有服务
firewall-cmd --add-service=http #添加服务
firewall-cmd --add-service=http --permanent #永久添加服务
firewall-cmd --remove-service=http #删除服务

记录一些ubuntu22.04上的操作

美化操作

更新

1
2
sudo apt update
sudo apt upgrade

安装相关依赖软件

1
2
sudo apt install gnome-tweaks chrome-gnome-shell
sudo apt install gnome-shell-extensions

美化

去到Firefox或者Chrome中下载gnome插件,然后下载对应的美化包、执行操作。这玩意儿装的扩展可以在系统菜单下的扩展里找到打开


flameshot安装使用

安装

1
sudo apt-get install flameshot

设置快捷键

使用指令flameshot gui即可对屏幕进行截取,一般在设置中增加自定义快捷键F1,将其与截屏指令绑定


对于aria2的安装使用

aria2的github仓库

基本

安装
1
sudo apt-get install aria2
配置
1
2
3
4
mkdir /etc/aria2    #新建文件夹 
touch /etc/aria2/aria2.session #新建session文件
chmod 777 /etc/aria2/aria2.session #设置aria2.session可写
vim /etc/aria2/aria2.conf #创建配置文件

这是aria2.conf文件对应内容,具体配置可更改:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
## 全局设置 ## ============================================================
# 日志
#log-level=warn
#log=/PATH/.aria2/aria2.log

# 后台运行
#daemon=true

# 下载位置, 默认: 当前启动位置
dir=/home/Aria2/Downloads/

# 从会话文件中读取下载任务 都用绝对路径
input-file=/etc/aria2/aria2.session

# 在Aria2退出时保存`错误/未完成`的下载任务到会话文件
save-session=/etc/aria2/aria2.session

# 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0
save-session-interval=30

# 断点续传
continue=true

# 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M
#disk-cache=32M

# 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc
# 预分配所需时间: none < falloc ? trunc < prealloc
# falloc和trunc则需要文件系统和内核支持
# NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项
file-allocation=none
# 客户端伪装
user-agent=netdisk;5.2.6;PC;PC-Windows;6.2.9200;WindowsBaiduYunGuanJia
referer=http://pan.baidu.com/disk/home

# 禁用IPv6, 默认:false
disable-ipv6=true

# 其他
always-resume=true
check-integrity=true

## 下载位置 ## ============================================================
# 最大同时下载任务数, 运行时可修改, 默认:5
max-concurrent-downloads=10

# 同一服务器连接数, 添加时可指定, 默认:1
max-connection-per-server=10

# 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M
# 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载
min-split-size=10M

# 单个任务最大线程数, 添加时可指定, 默认:5
split=5

# 整体下载速度限制, 运行时可修改, 默认:0
#max-overall-download-limit=0

# 单个任务下载速度限制, 默认:0
#max-download-limit=0

# 整体上传速度限制, 运行时可修改, 默认:0
#max-overall-upload-limit=0

# 单个任务上传速度限制, 默认:0
#max-upload-limit=0

## RPC设置 ## ============================================================
# 启用RPC, 默认:false
enable-rpc=true

# 允许所有来源, 默认:false
rpc-allow-origin-all=true

# 允许非外部访问, 默认:false
rpc-listen-all=true

# 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同
#event-poll=select

# RPC监听端口, 端口被占用时可以修改, 默认:6800
rpc-listen-port=6800

# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项
#rpc-secret=<TOKEN>

# 是否启用 RPC 服务的 SSL/TLS 加密,
# 启用加密后 RPC 服务需要使用 https 或者 wss 协议连接
#rpc-secure=true

# 在 RPC 服务中启用 SSL/TLS 加密时的证书文件,
# 使用 PEM 格式时,您必须通过 --rpc-private-key 指定私钥
#rpc-certificate=/path/to/certificate.pem

# 在 RPC 服务中启用 SSL/TLS 加密时的私钥文件
#rpc-private-key=/path/to/certificate.key

## BT/PT下载相关 ## ============================================================
# 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true
#follow-torrent=true

# BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999
listen-port=51413

# 单个种子最大连接数, 默认:55
#bt-max-peers=55

# 打开DHT功能, PT需要禁用, 默认:true
enable-dht=false

# 打开IPv6 DHT功能, PT需要禁用
#enable-dht6=false

# DHT网络监听端口, 默认:6881-6999
#dht-listen-port=6881-6999

dht-file-path=/opt/var/aria2/dht.dat
dht-file-path6=/opt/var/aria2/dht6.dat

# 本地节点查找, PT需要禁用, 默认:false
#bt-enable-lpd=false

# 种子交换, PT需要禁用, 默认:true
enable-peer-exchange=false

# 每个种子限速, 对少种的PT很有用, 默认:50K
#bt-request-peer-speed-limit=50K

# 设置 peer id 前缀
peer-id-prefix=-TR2770-

# 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0
seed-ratio=0

# 强制保存会话, 即使任务已经完成, 默认:false
# 较新的版本开启后会在任务完成后依然保留.aria2文件
#force-save=false

# BT校验相关, 默认:true
#bt-hash-check-seed=true

# 继续之前的BT任务时, 无需再次校验, 默认:false
bt-seed-unverified=true

# 保存磁力链接元数据为种子文件(.torrent文件), 默认:false
bt-save-metadata=true

bt-max-open-files=16

# Http/FTP 相关
connect-timeout=120

启动aria2
1
aria2c --conf-path=/etc/aria2/aria2.conf
使用

在可以正常启动的情况下,可以开启后台启动(终端不会显示进程日志)

1
aria2c --conf-path=/etc/aria2/aria2.conf -D

接下来选择使用web端或者客户端gui形式对下载任务、配置来可视化操作,前者在浏览器中下载“Aria2下载器集成组件”,后者可在aria2的安装路径下使用命令行启动
aria2-web管理

可选

设置aria2开机启动

新建启动脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
### BEGIN INIT INFO
# Provides: aria2
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Aria2 Downloader
### END INIT INFO

case "$1" in
start)

echo -n "已开启Aria2c"
sudo aria2c --conf-path=/etc/aria2/aria2.conf -D
;;
stop)

echo -n "已关闭Aria2c"
killall aria2c
;;
restart)

killall aria2c
sudo aria2c --conf-path=/etc/aria2/aria2.conf -D
;;
esac
exit
修改文件权限(a+x)
1
sudo chmod 755 /etc/init.d/aria2c
添加开机启动服务
1
sudo update-rc.d aria2c defaults
启动
1
sudo service aria2c start
可查看服务状态
1
sudo systemclt status aria2c

安装搜狗输入法

搜狗官方安装文档

更新

1
sudo apt update

安装fcitx

1
sudo apt install fcitx

然后可以使用优化或者命令行使得fcitx可以开机自启动

安装搜狗输入法

去到搜狗输入法官网下载对应版本,

–> 官网,然后解压安装

安装
1
2
sudo apt install libqt5qml5 libqt5quick5 libqt5quickwidgets5 qml-module-qtquick2
sudo apt install libgsettings-qt1

重启之后就能看到Fcitx对应的输入法了,再对其稍稍配置

卸载默认的ibus输入法框架(可选)
1
sudo apt purge ibus

针对firefox无法打开简书

  1. 地址栏输入about:config,接受风险进入
    风险警告

  2. 上方搜索栏查找general.useragent.overrride,未找到则新建字符串,填入Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
    新建字符串,后续即可访问

评论