常见的 Centos Debian 更新源 1 2 3 4 5 6 7 8 9 10 11 12 13 # centos更新您的服务器,在系统中更新已安装软件包的版本 yum -y update # epel-release centos 库,软件源 yum install epel-release # Debian更新您的服务器,在系统中更新已安装软件包的版本 apt -y update # 或者 apt-get update 可在前面面加上sudo ,给予root权限,可加可不加
更换软件源 Debian 10为例子 #先备份原有 软件源 cp /etc/apt/sources.list /etc/apt/sources.list.bak
#更新 apt-get update
1 2 3 4 5 6 7 8 9 10 11 echo " deb http://mirrors.aliyun.com/debian/ buster main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib deb http://mirrors.aliyun.com/debian-security buster/updates main deb-src http://mirrors.aliyun.com/debian-security buster/updates main deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib " >/etc/apt/sources.list
更多 清华大学源:https://mirrors.tuna.tsinghua.edu.cn/ 中科大源:https://mirrors.ustc.edu.cn/ 找到对应系统旁边的问号即可进入
debian源:https://mirrors.tuna.tsinghua.edu.cn/help/debian/
ubuntu源:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
centos源:https://mirrors.tuna.tsinghua.edu.cn/help/centos/
linux 一些基础 大部分都以 Debian 为例子
常用的命令 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 # 比如FinalShell需要用到的网络监控 yum install net-tools -y # 安装后使用 ifconfig -a 或者 ifconfig 查询网卡信息 # 这里都懂把? yum install wget curl unzip -y apt install wget curl unzip -y 这里是一些我为快自用的... apt-get update apt-get install wget curl unzip screen net-tools -y apt-get -y install ipset
修改dns(重启失效) 您选择了选项3 修改为根和CF的V4 DNS 以及 V6 (谷歌的DNS)
1 2 3 4 echo "nameserver 8.8.8.8" > /etc/resolv.conf echo "nameserver 1.1.1.1" >> /etc/resolv.conf echo "nameserver 2001:4860:4860::8888" >> /etc/resolv.conf echo "nameserver 2001:4860:4860::8844" >> /etc/resolv.conf
#删除文件
#结束进程 (通过进程名)
创建文件夹
后台运行 如果能更建议systemctl的进程守护
1 2 3 4 5 6 7 8 9 apt install screen -y # 快速执行 screen(不需要 Ctrl+A+D 键) screen -dmS [名字] [命令] 例子 screen -dmS nmsl ./root/xray
chmod权限解答 首先有3个级别要设置,【所有者】,【组】,【其他】 7 读 + 写 + 执行 6 读 + 写 5 读 + 执行 4 只读 3 写 + 执行 2 只写 1 只执行 0 无
如简单的【chmod 777 x.sh】就是给x.sh文件 -所有者-组-其他- 上面的第7号权限,也是读 + 写 + 执行 【chmod 544 ntp】的意思就是 ,给与NTP,所有者能读 + 执行,组只读 ,其他只读 权限
清楚系统日志 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 # sudo rm -rvf /var/cache/apt/* /var/lib/apt/lists/* /tmp/* # sudo find /var/log/ -type f | xargs sudo rm -rvf # 此文件默认打开时乱码,可查到ip等信息 echo >/var/log/wtmp # 此文件默认打开时乱码,可查到登陆失败信息,清除登陆系统失败的记录 echo > /var/log/btmp # rm -rvf ~/.bash_history ~/.zsh_history # 只有是 finalshell SSH连接才需要清除 rm -fr .finalshellc rm -fr finalshellc # 清空历史执行命令 history -c
linux用户 和 密码 一些简单的技巧
linux添加用户并赋予root权限 为了更好的展示,这里写的很简单 1.创建用户密码
1 2 3 4 5 6 7 8 9 # 创建用户yunyan useradd yunyan # 为用户yunyan设置密码 passwd yunyan # 接下来需要输入密码和确认密码
2.授予root权限
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 # 由于sudoers文件只读权限,临时设置为可写权限 # 当然,也可以执行修改sudoers,保存时使用vim命令w!强制保存 chmod -v u+w /etc/sudoers # vim编辑sudoers vim /etc/sudoers # 搜索root ALL=(ALL) ALL # 复制添加一行 yunyan ALL=(ALL) ALL # 恢复文件只读权限 chmod -v u-w /etc/sudoers
3.将用户添加到root用户组
1 2 3 4 5 6 7 8 9 # 设置用户组 usermod -g root yunyan vim /etc/passwd 将 yunyan:x:1001:0::/home/yunyan:/bin/bash 修改为 yunyan:x:0:0::/home/yunyan:/bin/bash OK了,这样用yunyan登录后就是ROOT,进入也是cd ~目录,有时间写个一键脚本把。。emm
快速开启ROOT登录,并设置密码 PS:不保证所有系统都可以用哦~!目前适用于亚马逊和微软 第一行的“root:your”就是root+你的密码,改your就行了,换成你想设置的密码
1 2 3 4 5 6 echo root:your password |sudo chpasswd root sudo sed -i 's/^#\?PermitRootLogin.*/PermitRootLogin yes/g' /etc/ssh/sshd_config; sudo sed -i 's/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g' /etc/ssh/sshd_config; sudo service sshd restart
第三方工具 / BBR /测速 TCP PING 单纯个人更喜欢用这个
1 2 3 4 5 6 7 wget https://github.com/pouriyajamshidi/tcping/releases/download/v1.19.2/tcping_Linux.tar.gz tar -xvf tcping_Linux.tar.gz chmod +x tcping sudo cp tcping /usr/local/bin/ # 示例例子 tcping 忘记了...
BBR 来源 https://github.000060000.xyz/
下面提供为,不卸载内核版本
1 2 3 wget -O tcpx.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
SWAP虚拟内存 给linux 添加SWAP虚拟内存
可以解决部分内存不足的情况
如果硬盘限制了读写速度,那么非常不建议使用哦!
1 bash <(wget --no-check-certificate -qO- https://cdn.jsdelivr.net/gh/Moexin/Shell@master/Swap.sh)