archlinux常用高级指令

command

Posted by MetaNetworks on August 28, 2022
本页面总访问量

btrfs

btrfs checksum error

查看checksum对应的文件,可以进行删除

1
sudo journalctl --dmesg --grep 'checksum error'

yay

yay忽略checksum安装

以HUST的easyconnect为例.

1
yay easyconnect --mflags --skipinteg

Virtual Box

Host resource of type “Other Storage Device (20)” is supported with SATA AHCI controllers only, line 47.

通常发生在VMware导出ovf,然后导入Virutal Box过程中。

  • replace word “ElementName” with word “Caption” in the whole file
  • replace “vmware.sata.ahci” with “AHCI”
  • replace “vmware.nvme.controller” with “AHCI”

KDE桌面重启

KDE对多屏支持太烂,容易卡桌面。直接kill吧!

1
ps -A | grep plasmashell | awk '{ print $1}' | xargs kill -9

Flutter Linux native vscode代码提示

1
pkg-config --cflags gtk+-3.0

拿到结果后加入vscode c++ include path中,另外导入flutter engine的头文件: /path/to/flutter/bin/cache/artifacts/engine/linux-x64

wget无法访问SSL网站,但是curl可以SSL访问

之前在do-release-upgrade升级ubuntu后遇到了这个问题,

1
sudo apt update && sudo apt install --reinstall ca-certificates

再检查下vm时间,若还是不行,在/etc/wgetrc中加入:

1
ca_directory=/etc/ssl/certs

允许non root用户bind 80/443端口

  • 使用setcap授权二进制文件,永久生效,文件改变则失效
    1
    
    sudo setcap CAP_NET_BIND_SERVICE=+eip /path/to/binary
    
  • 使用authbind指令(一次性)
1
2
3
4
sudo touch /etc/authbind/byport/80
sudo touch /etc/authbind/byport/443
sudo chmod 777 /etc/authbind/byport/80
sudo chmod 777 /etc/authbind/byport/443

然后使用authbind --deep [commands]完成执行

btrfs下设立swap分区

1
2
3
4
5
6
7
8
9
10
11
12
13
# 设置一个大小为0的文件
sudo truncate -s 0 /swapfile
sudo chattr +C /swapfile
# 不压缩
sudo btrfs property set /swapfile compression none
# 16G虚拟内存
sudo dd if=/dev/zero of=/swapfile bs=1M count=16384
# 编辑fstab开机自动挂载
+ /swapfile none swap defaults 0 0
# 配置swap文件
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

VirtualBox 反注册/删除磁盘镜像

1
2
vboxmanage list hdds
vboxmanage closemedium disk DISK_UUID --delete

Git

  • 将编辑器换为vim
    • git config --global core.editor "vim"

iptables开放端口

iptables -A INPUT -p tcp --dport 端口号 -j ACCEPT

常见参数如下:

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
--append         -A         -- append rules to end of specified chain                                                                                         
--delete         -D         -- delete rules from specified chain                                                                                              
--delete-chain   -X         -- delete a user-defined chain                                                                                                    
--destination    --dst  -d  -- specify destination                                                                                                            
--exact          -x         -- expand numbers (display exact values)                                                                                          
--flush          -F         -- flush specified chain (delete all rules)                                                                                       
--fragment       -f         -- match second or further fragments only                                                                                         
--help           -h         -- print program information                                                                                                      
--in-interface   -i         -- specify interface via which packet is received                                                                                 
--insert         -I         -- insert rules before specified rule number                                                                                      
--jump           -j         -- specify rule target                                                                                                            
--line-numbers              -- print line numbers when listing                                                                                                
--list           -L         -- list rules in selected chain                                                                                                   
--match          -m         -- extended match (may load extension)                                                                                            
--modprobe                  -- specify command to load modules with                                                                                           
--new-chain      --new  -N  -- create a new user-defined chain                                                                                                
--numeric        -n         -- print IP addresses and port numbers in numeric format                                                                          
--out-interface  -o         -- specify interface via which packet is to be sent                                                                               
--policy         -P         -- set the policy for a chain to given target                                                                                     
--protocol       -p         -- specify protocol of rule                                                                                                       
--rename-chain   -E         -- rename a user-defined chain                                                                                                    
--replace        -R         -- replace a rule                                                                                                                 
--set-counters   -c         -- initialise packet and byte counters                                                                                            
--source         --src  -s  -- specify source                                                                                                                 
--table          -t         -- specify table                                                                                                                  
--verbose        -v         -- enable verbose output                                                                                                          
--version        -V         -- print version information                                                                                                      
--zero           -Z         -- zero the packet and byte counters