本站地址:https://tenyon.cn
Linux
登录
立刻重启
shutdown -r now
登录管理员
su root
查看 ip
ip addr show
网络
修改 dphc
vi /etc/sysconfig/network-scripts/ifcfg -e +tap
重启网络
service network restart 172.16.176.143
查看网络 端口
netstat -an | more
防火墙
开启防火墙
systemctl start firewalld
防火墙状态
systemctl status firewalld
停止防火墙
systemctl stop firewalld.service
禁止防火墙开机启动
systemctl disable firewalld.service
SSH 服务
ps:_ssh 连接后可以在 ip1 下面连接 ip2 然后 exit 退出
启动 ssh 服务
systemctl start sshd.service
关闭 ssh 服务
systemctl stop sshd.service
重启 ssh 服务
systemctl enable sshd.service
开机启动 ssh 服务
systemctl enable sshd.service
文件夹
创建文件夹
mkdir xxx
删除文件
rm -rf xxx
移动文件夹
mv x ./xx
递归拷贝文件夹
cp -R a.x aa.xx
切换路径
cd xxx/
完整路径
pwd
目录下信息
ls
目录详细内容
ll
用户所在的文件夹
cd ~
执行某个文件
./xxx
如果没有就是创建
vi xxx.txt
打开文件
vi xxx
编辑
i
退出保存
esc:wq
授权
ps:_-r 可读 4-w 可写 2-x 可执行 1 用二进制表示的 user group other 三组
完全公开
chown nobody:nobody xxx.txt
完全公开文件夹
chown -R nobody:nobody test
授权文件
chmod 777 bbb
授权文件夹
chmod -R 777 test
安装软件
解压缩文件
tar -xvf xxx.tar.gz
安装单个
rpm -ivh xxx.rpm
安装全部
rpm -ivh *.rpm force
安装 bin 包
./xxxxx.bin
其他
yum install docker
yum install nginx
性能
cpu性能
cat /proc/cpuinfo| grep "cpu"
cpu使用率
yum install epel-release yum install htop
top
磁盘空间
df -h
网络
iftop
ip
yum install net-tools
ifconfig
查看所有进程/某个进程
ps -ef |grep xxx
进程信息放到txt中
>>重定向符号
ps -ef >>a.txt
仅仅查看
cat a.txt
数据库
创建
CREATE USER 'yovvis'@'localhost' IDENTIFIED BY 'yovvis666';
修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
FLUSH PRIVILEGES;
授权
mysql> grant all privileges on . to yovvis@'localhost';
SHOW GRANTS FOR 'username'@'host';
脱敏
-- 姓名
update userinfo SET username = rpad(substring(username, 1, 1 ), char_length(username), '*' ) where 1=1
-- 电话
update userinfo SET username = CONCAT(LEFT (username, 3 ), '****' ,RIGHT(username,4)) where 1=1
-- 单位
update ouinfo SET ouname = REPLACE (ouname, SUBSTRING(ouname,1,2),'**' ) WHERE ouname regexp '市'
Node 配置
环境配置
npm config set prefix "D:\envs\nodejs\node_global"
npm config set cache "D:\envs\nodejs\node_cache"
npm config set registry https://registry.npm.taobao.org
npm i -g yarn
yarn config set prefix "D:\envs\nodejs\yarn_global"
yarn config set global-folder "D:\envs\nodejs\yarn_global"
yarn config set cache-folder "D:\envs\nodejs\yarn_cache"
yarn config set registry https://registry.npm.taobao.org
更新 package.json
全局安装
npm-check-updates
npm i -g npm-check-updates
检查版本
ncu
执行命令
ncu -u to upgrade package.json
重新安装
npm install
更新指定包
yarn add [package_name]@latest
更新包里面全部
yarn upgrade / npm update
Git
提交取消 crlf 转 lf
自动转
git config --global core.autocrlf true
取消自动转
git config --global core.safecrlf false
拉代码
克隆代码
git clone -b main http://192.168.0.200/product-group/.git
idea 初始化
git init
git add .
git commit -m "first"
git remote add origin xxxxx
git push -u origin "xxx"