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

screen -S myScreen

screen -r myScreen

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

du -h --max-depth=1

访问NFS服务

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

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

# 开始挂载
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

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

一键删除所有项目下的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.rar

含密码的压缩解压:

格式压缩解压
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

使用Mutt收发邮件

配置Mutt:

vim ~/.config/mutt/muttrc
------------------------------------------------
# COMMON
set editor="vim"

# IMAP
set imap_user=xxxxxx@qq.com
set imap_pass=xxxxxxxxxxxxxxxx
set folder=imaps://imap.qq.com
set spoolfile = +INBOX

# SMTP
set from=xxxxxx@qq.com
set smtp_pass = $imap_pass
set smtp_url=smtps://$imap_user@smtp.qq.com
set record = ~/.cache/mutt/sent
set postponed = ~/.cache/mutt/postponed
------------------------------------------------

发送邮件:

# 发送邮件(以下三条命令等效)
mutt -s "主题" @qq.com < 消息.txt
mutt -s "主题" yyyyyy@qq.com <<< "Hello World"
echo "Hello World" | mutt -s "主题" yyyyyy@qq.com

# 发送邮件(携带附件)
mutt -s "主题" -a 附件.txt -- yyyyyy@qq.com <<< "Hello World"

# 发送邮件(HTML格式)
mutt -s "主题" -e "set content_type=text/html" yyyyyy@qq.com <<< "<h1>Hello World</h1>"

接受邮件:

# 进入Mutt主界面查看邮件
mutt

接受邮件时使用W3M渲染HTML:

vim ~/.config/mutt/mailcap
------------------------------------------------------------
text/html; w3m -I %{charset} -T text/html; copiousoutput;
------------------------------------------------------------
vim ~/.config/mutt/muttrc
------------------------------------------------
# OPTION: Render HTML
set mailcap_path = ~/.config/mutt/mailcap
auto_view text/html
alternative_order text/plain text/html
------------------------------------------------