会话管理——使用screen恢复掉线的shell会话

screen -S myScreen

screen -r myScreen

显示当前目录所占用的磁盘空间

du -h --max-depth=1

访问NFS服务

sudo pacman -S core/nfs-utils #ArchLinux下安装nfs-utils,不然没有showmount命令

showmount -e 192.168.1.105 #显示指定IP上挂载的卷

sudo mount -t nfs -o proto=tcp,nolock 192.168.1.105:/volume1/homes homes/ #开始挂载

访问SMB服务

sudo pacman -S smbclient #安装

smbclient -L 192.168.0.100 -U username%password # 显示共享目录

smbclient //192.168.0.100/directory -U username%password # 进入上述共享目录中的directory目录

一键删除所有项目下的target

find . -name target | awk '{print "rm -rf "$1}' | sh

扫描局域网所有IP与端口

nmap -sP 192.168.1.0/24

nmap -A 192.168.1.100

压缩与解压

格式压缩解压
tar.gztar czvf test.tgz test/tar xzvf test.tgz
tar.xztar cJvf test.txz test/tar xJvf test.txz
zipzip -r test.zip test/unzip test.zip
7z7z a -t7z test.7z test/7z x test.7z
rar-unrar x test.ra

含密码的压缩解压:

格式压缩解压
tar (GnuPG)tar czvf - test/ | gpg -co test.tgz.gpggpg -d test.tgz.gpg | tar xzvf -
tar (OpenSSL)tar czvf - test/ | openssl enc -des3 -out test.tgzopenssl enc -d -des3 -in test.tgz | tar xzvf -
zipzip -r -e test.zip test/unzip test.zip
7z7z a -t7z -p test.7z test/7z x test.7z

科学上网

科学上网服务端

参见Shadowsocks 一键安装脚本(四合一)

wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh
chmod +x shadowsocks-all.sh
./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log
# 启用防火墙入站规则
sudo ufw allow in 16666

科学上网客户端

sudo pacman -S shadowsocks
sudo sslocal -c /etc/shadowsocks/example.json -d start # 编辑/etc/shadowsocks/example.json,与服务端配置保持一致

sudo pacman -S privoxy
sudo systemctl start privoxy.service

内网穿透

内网穿透服务端

wget https://github.com/fatedier/frp/releases/download/v0.51.2/frp_0.51.2_linux_amd64.tar.gz
tar xvf frp_0.51.2_linux_amd64.tar.gz
cd frp_0.51.2_linux_amd64/
vim frps.ini # 编辑内容如下
nohup ./frps -c ./frps.ini &
[common]
bind_port = 7000

vhost_http_port = 80
vhost_https_port = 443

dashboard_port= 7500
dashboard_user = frp
dashboard_pwd = Passw0rd

token = Token001
# 启用防火墙入站规则
sudo ufw allow in 7000
sudo ufw allow in 7500
sudo ufw allow in 80
sudo ufw allow in 443

内网穿透客户端

sudo pacman -S frpc
vim /etc/frp/frpc.ini # 编辑内容如下
nohup frpc -c /etc/frp/frpc.ini &
[common]
server_addr = xxx.xxx.xxx.xxx
server_port = 7000
token = Token001

[ssh]
type = tcp
local_ip = 127.0.0.1
local_port = 22
remote_port = 6000

[web01]
type = http
local_ip = 127.0.0.1
local_port = 8080
custom_domains = xxx.xxx.xxx.xxx

xxx.xxx.xxx.xxx为远程服务器的IP

# 通过服务器的6000端口访问本地ssh
ssh luanrz@xxx.xxx.xxx.xxx -p 6000
# 通过服务器的80端口访问本地8080服务
curl http://xxx.xxx.xxx.xxx