wuweiluohua / vps_setup

linux vim bash 脚本学习笔记 by 蘭雅sRGB https://262235.xyz/

Home Page:https://262235.xyz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub stars GitHub forks

🔔 我們雖然窮,但是不能說謊,也不能打人;不是我們的東西,我們不能拿;

💯 要好好讀書,長大要做個對社會有用的人。



😍Linux 简单命令工具和简易脚本

点击展开内容

XPath Helper 简单使用方法

1.开启插件 (ctrl+shif+x)
2.鼠标移动到一个标题上方
3.按 shift 键,提取xpath
4.删除xpath尾部[方括号]
  
/a 链接文件    /a/@href  链接地址
  
/html/body[@class='home  pace-done']/section[@class='container']/div[@class='content-wrap']/div[@class='content']/article[@class='excerpt']/header/h2/a/@href

https://262235.xyz/index.php/archives/691/ https://262235.xyz/index.php/archives/687/ https://262235.xyz/index.php/archives/681/ https://262235.xyz/index.php/archives/674/ https://262235.xyz/index.php/archives/669/ https://262235.xyz/index.php/archives/664/ https://262235.xyz/index.php/archives/658/ https://262235.xyz/index.php/archives/654/ https://262235.xyz/index.php/archives/652/ https://262235.xyz/index.php/archives/651/ https://262235.xyz/index.php/archives/645/ https://262235.xyz/index.php/archives/643/ https://262235.xyz/index.php/archives/637/ https://262235.xyz/index.php/archives/628/ https://262235.xyz/index.php/archives/625/ https://262235.xyz/index.php/archives/617/ https://262235.xyz/index.php/archives/611/ https://262235.xyz/index.php/archives/603/ https://262235.xyz/index.php/archives/602/ https://262235.xyz/index.php/archives/599/ https://262235.xyz/index.php/archives/596/ https://262235.xyz/index.php/archives/594/ https://262235.xyz/index.php/archives/593/ https://262235.xyz/index.php/archives/589/ https://262235.xyz/index.php/archives/588/ https://262235.xyz/index.php/archives/584/ https://262235.xyz/index.php/archives/578/ https://262235.xyz/index.php/archives/573/ https://262235.xyz/index.php/archives/570/ https://262235.xyz/index.php/archives/568/ https://262235.xyz/index.php/archives/563/ https://262235.xyz/index.php/archives/554/ https://262235.xyz/index.php/archives/550/ https://262235.xyz/index.php/archives/542/ https://262235.xyz/index.php/archives/540/ https://262235.xyz/index.php/archives/537/ https://262235.xyz/index.php/archives/536/ https://262235.xyz/index.php/archives/532/ https://262235.xyz/index.php/archives/528/ https://262235.xyz/index.php/archives/522/ https://262235.xyz/index.php/archives/516/ https://262235.xyz/index.php/archives/513/ https://262235.xyz/index.php/archives/510/ https://262235.xyz/index.php/archives/507/ https://262235.xyz/index.php/archives/504/ https://262235.xyz/index.php/archives/496/ https://262235.xyz/index.php/archives/494/ https://262235.xyz/index.php/archives/486/ https://262235.xyz/index.php/archives/482/ https://262235.xyz/index.php/archives/478/ https://262235.xyz/index.php/archives/473/ https://262235.xyz/index.php/archives/468/ https://262235.xyz/index.php/archives/462/ https://262235.xyz/index.php/archives/460/ https://262235.xyz/index.php/archives/453/ https://262235.xyz/index.php/archives/451/ https://262235.xyz/index.php/archives/448/ https://262235.xyz/index.php/archives/446/ https://262235.xyz/index.php/archives/440/ https://262235.xyz/index.php/archives/438/ https://262235.xyz/index.php/archives/434/ https://262235.xyz/index.php/archives/431/ https://262235.xyz/index.php/archives/425/ https://262235.xyz/index.php/archives/423/ https://262235.xyz/index.php/archives/416/ https://262235.xyz/index.php/archives/415/ https://262235.xyz/index.php/archives/411/ https://262235.xyz/index.php/archives/409/ https://262235.xyz/index.php/archives/408/ https://262235.xyz/index.php/archives/401/ https://262235.xyz/index.php/archives/400/ https://262235.xyz/index.php/archives/397/ https://262235.xyz/index.php/archives/396/ https://262235.xyz/index.php/archives/394/ https://262235.xyz/index.php/archives/391/ https://262235.xyz/index.php/archives/385/ https://262235.xyz/index.php/archives/380/ https://262235.xyz/index.php/archives/375/ https://262235.xyz/index.php/archives/373/ https://262235.xyz/index.php/archives/372/ https://262235.xyz/index.php/archives/371/ https://262235.xyz/index.php/archives/370/ https://262235.xyz/index.php/archives/369/ https://262235.xyz/index.php/archives/366/ https://262235.xyz/index.php/archives/362/ https://262235.xyz/index.php/archives/351/ https://262235.xyz/index.php/archives/342/ https://262235.xyz/index.php/archives/336/ https://262235.xyz/index.php/archives/326/ https://262235.xyz/index.php/archives/321/ https://262235.xyz/index.php/archives/315/ https://262235.xyz/index.php/archives/313/ https://262235.xyz/index.php/archives/311/ https://262235.xyz/index.php/archives/309/ https://262235.xyz/index.php/archives/301/ https://262235.xyz/index.php/archives/299/ https://262235.xyz/index.php/archives/298/ https://262235.xyz/index.php/archives/291/ https://262235.xyz/index.php/archives/287/ https://262235.xyz/index.php/archives/285/ https://262235.xyz/index.php/archives/284/ https://262235.xyz/index.php/archives/280/ https://262235.xyz/index.php/archives/277/ https://262235.xyz/index.php/archives/274/ https://262235.xyz/index.php/archives/273/ https://262235.xyz/index.php/archives/272/ https://262235.xyz/index.php/archives/271/ https://262235.xyz/index.php/archives/262/ https://262235.xyz/index.php/archives/257/ https://262235.xyz/index.php/archives/252/ https://262235.xyz/index.php/archives/250/ https://262235.xyz/index.php/archives/249/ https://262235.xyz/index.php/archives/245/ https://262235.xyz/index.php/archives/243/ https://262235.xyz/index.php/archives/242/ https://262235.xyz/index.php/archives/240/ https://262235.xyz/index.php/archives/237/ https://262235.xyz/index.php/archives/235/ https://262235.xyz/index.php/archives/233/ https://262235.xyz/index.php/archives/231/ https://262235.xyz/index.php/archives/228/ https://262235.xyz/index.php/archives/226/ https://262235.xyz/index.php/archives/220/ https://262235.xyz/index.php/archives/217/ https://262235.xyz/index.php/archives/216/ https://262235.xyz/index.php/archives/214/ https://262235.xyz/index.php/archives/211/ https://262235.xyz/index.php/archives/205/ https://262235.xyz/index.php/archives/203/ https://262235.xyz/index.php/archives/193/ https://262235.xyz/index.php/archives/191/ https://262235.xyz/index.php/archives/187/ https://262235.xyz/index.php/archives/179/ https://262235.xyz/index.php/archives/177/ https://262235.xyz/index.php/archives/164/ https://262235.xyz/index.php/archives/161/ https://262235.xyz/index.php/archives/159/ https://262235.xyz/index.php/archives/155/ https://262235.xyz/index.php/archives/148/ https://262235.xyz/index.php/archives/141/ https://262235.xyz/index.php/archives/135/ https://262235.xyz/index.php/archives/134/ https://262235.xyz/index.php/archives/132/ https://262235.xyz/index.php/archives/130/ https://262235.xyz/index.php/archives/128/ https://262235.xyz/index.php/archives/124/ https://262235.xyz/index.php/archives/119/ https://262235.xyz/index.php/archives/112/ https://262235.xyz/index.php/archives/107/ https://262235.xyz/index.php/archives/104/ https://262235.xyz/index.php/archives/101/ https://262235.xyz/index.php/archives/97/ https://262235.xyz/index.php/archives/93/ https://262235.xyz/index.php/archives/86/ https://262235.xyz/index.php/archives/83/ https://262235.xyz/index.php/archives/74/ https://262235.xyz/index.php/archives/73/ https://262235.xyz/index.php/archives/70/ https://262235.xyz/index.php/archives/61/ https://262235.xyz/index.php/archives/53/ https://262235.xyz/index.php/archives/46/ https://262235.xyz/index.php/archives/44/ https://262235.xyz/index.php/archives/41/ https://262235.xyz/index.php/archives/39/ https://262235.xyz/index.php/archives/37/ https://262235.xyz/index.php/archives/33/ https://262235.xyz/index.php/archives/32/ https://262235.xyz/index.php/archives/28/ https://262235.xyz/index.php/archives/27/ https://262235.xyz/index.php/archives/25/ https://262235.xyz/index.php/archives/23/ https://262235.xyz/index.php/archives/22/ https://262235.xyz/index.php/archives/20/ https://262235.xyz/index.php/archives/18/ https://262235.xyz/index.php/archives/16/ https://262235.xyz/index.php/archives/11/ https://262235.xyz/index.php/archives/8/ https://262235.xyz/index.php/archives/6/ https://262235.xyz/index.php/archives/3/ https://262235.xyz/index.php/archives/1/

grep ip 并计数

grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c| sort -nrk 1

# 应用: 统计自己电信服务商IP动态变化
cat /var/log/udp2raw.log \
  | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c| sort -nrk 1

# 统计哪些IP在扫描你的vps
cat /var/log/auth.log \
  | grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | sort | uniq -c| sort -nrk 1

# 查询IP信息
https://www.ipip.net/ipquery.html

一些表情例子 EMOJI

  • 😄 😆 😵 😭 😰 😅 😢 😤 😍 😌
  • 👍 👎 💯 👏 🔔 🎁 ❓ 💣 ❤️ ☕ 🌀 🙇 💋 🙏 💢
:smile: :laughing: :dizzy_face: :sob: :cold_sweat: :sweat_smile:  :cry: :triumph: :heart_eyes: :relieved:
:+1: :-1: :100: :clap: :bell: :gift: :question: :bomb: :heart: :coffee: :cyclone: :bow: :kiss: :pray: :anger:

安装工具 tmux 和 fish 等

apt install tmux fish  -y

GCP_AZ_AWS_Virmach等小内存优化,htop 或者 systemctl查看有的任务

systemctl | grep running

systemctl disable   google-accounts-daemon.service
systemctl disable   google-clock-skew-daemon.service
systemctl disable   google-network-daemon.service
systemctl disable   google-osconfig-agent.service

systemctl disable  unattended-upgrades.service
systemctl disable  fail2ban
systemctl disable  rsyslog
systemctl disable  cron
systemctl disable  getty@tty2.service
systemctl disable  console-getty.service

微软B1ls 内存只给420M运行Docker崩溃只好开虚拟内存

# WALinuxAgent (waagent) 卸载
systemctl disable walinuxagent

# Swap 交换空间

fallocate -l 1G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile

echo "/swapfile swap swap defaults 0 0"  >>  /etc/fstab


# 其他优化设定
vim /etc/sysctl.conf

vm.min_free_kbytes = 18600
vm.swappiness = 5

sysctl -p


网上找了文章  《Azure 乞丐版 B1ls 的正确使用姿势 压榨极致性能》
先凑合着用吧,反正是备用机,续签的 99刀应该可以用一年
----------------
## crontab -l
1   *   */7  *  *   reboot
59  *    *   *  *    wget -qO- git.io/fxxlb | bash
8  */8   *   *  *   docker run --rm  hostloc  用户 密码

在Android手机上安装Termux应用,测试学习10个秘密和酷命令!

1) apt install sl
     sl
2) factor "Any Number"
3) apt install fish
     fish
4) apt install figlet
     figlet "Any Text"
5) apt install cmatrix
     cmatrix
6) apt install fortune
     fortune
7) apt install toilet
     toilet "Any Text"
     toilet -f mono12 -F gay "Any Text"
8) apt install w3m
     w3m "any websites"
     example:- w3m google.com
9) ifconfig
10) apt install cowsay
      cowsay "Any Text"

acme协议从letsencrypt生成免费的证书

#!/usr/bin/env sh

# https://github.com/Neilpang/acme.sh/wiki/说明

# 安装ssl依赖 和 acme.sh工具
apt-get install socat netcat -y
curl  https://get.acme.sh | sh

# 设置域名
DOMAIN=ssl.srgb888.ga

# 生成域名ssl证书
~/.acme.sh/acme.sh  --issue -d ${DOMAIN}  --webroot  /var/www/html --standalone -k ec-256 --force

如果你用的nginx服务器,以后可以使用一行命令更新证书

~/.acme.sh/acme.sh  --issue -d ssl.srgb888.ga  --nginx  --standalone -k ec-256 --force

Linux 使用代理 加速git 和安装软件

#!/bin/bash
# socks5tohttp.sh

brook socks5tohttp -s 127.0.0.1:1080 -l 0.0.0.0:8010 &
ps aux | grep -E brook

export http_proxy="http://127.0.0.1:8010"
export https_proxy="http://127.0.0.1:8010"
  • Windows 系统脚本 VPN --> socks5 --> http代理 给手机使用
::  Brook 开启 socks5  再转http
start /b  brook socks5 -l :1080 -i 0.0.0.0
sleep 1
start /b  brook socks5tohttp -s 127.0.0.1:1080 -l 0.0.0.0:8010

安装 brook 用来 Socks5 转 HTTP 代理

$ curl -L https://github.com/txthinking/brook/releases/download/v20200909/brook_linux_amd64 -o /usr/bin/brook
$ chmod +x /usr/bin/brook

# 32位系统安装
$ curl -L https://github.com/txthinking/brook/releases/download/v20200909/brook_linux_386 -o /usr/bin/brook

  • Socks5 转 HTTP 代理
$ brook socks5tohttp -s 127.0.0.1:1080  -l 127.0.0.1:8010
  • 中继: 可以将地址中继到远程地址。 它可以中继任何tcp和udp服务器
$ brook relay -f :9999 -t 1.2.3.4:9999
  • brook socks5 运行一个独立的标准socks5服务器(TCP和UDP)
$ brook socks5 -l :1080 -i 0.0.0.0

Linux 让终端走代理的几种方法

ssh保持长连接的方式,方法有以下三种:

1.修改server端的etc/ssh/sshd_config

ClientAliveInterval 60 #server每隔60秒发送一次请求给client,然后client响应,从而保持连接
ClientAliveCountMax 3 #server发出请求后,客户端没有响应得次数达到3,就自动断开连接,正常情况下,client不会不响应

systemctl reload sshd

2.修改client端的etc/ssh/ssh_config添加以下:(在没有权限改server配置的情形下)

ServerAliveInterval 60 #client每隔60秒发送一次请求给server,然后server响应,从而保持连接
ServerAliveCountMax 3  #client发出请求后,服务器端没有响应得次数达到3,就自动断开连接,正常情况下,server不会不响应

3.在命令参数里ssh -o ServerAliveInterval=60 这样子只会在需要的连接中保持持久连接, 毕竟不是所有连接都要保持持久的

Xshell 7 操作 Docker Python3 学习编程 在线阅读

Linux Command 命令大全 命令列表 离线包

公益中小学教学视频 - 免费观看 在线阅读

旧手机烂手机不要换锈钢脸盆,安装Linux Deploy做移动服务器 在线阅读

群晖NAS部署自动PT工具 感谢大神TaterLi 在线阅读

一键 WordPress 博客安装脚本,同时也是 LNMP 套件 在线阅读

宇宙第一大站 IPT 刷上传,守株待兔也能活 在线阅读

Typecho 自用博客笔记安装 上篇 下篇:Typecho-theme-DUX 主题安装

Oracle VM VirtualBox 安装虚拟机 Debian 10 挖坑填坑笔记 在线阅读

Arch Linux 安装简易版 For VirtualBox 安装虚拟机 填坑笔记 在线阅读

黑五变态机有救,可以用NFS挂载一个僚机 在线阅读


网友视频和白话文档

Debian 10 Buster 管理员手册 在线阅读

  • Debian 开发者和 Debian 手册作者 Raphaël Hertzog 宣布面向 Debian 10 的最新版本 Debian 管理员手册已上线。

About

linux vim bash 脚本学习笔记 by 蘭雅sRGB https://262235.xyz/

https://262235.xyz/


Languages

Language:Python 75.3%Language:Shell 16.3%Language:Dockerfile 5.7%Language:PHP 2.7%