当前位置: 首页 > news >正文

linux学习笔记 常用命令记录

1、linux查看系统版本lsb_release -a

2、查看目录所在的磁盘卷的容量

df -h /usr

 3、在Ubuntu 20.04中将时间设置为24小时制

        可以通过编辑 /etc/default/locale 文件来实现

#  File generated by update-locale
LANG="zh_CN.UTF-8"
LANGUAGE="zh_CN:zh"

 4、服务器间copy文件

 scp /home/zyh/app_inference/*  root@目标服务器ip:/home/zyh/app_inference/

5、supervisor的常见配置

[program:txwxh-mh.lw-i.com.cn.5117]
command=dotnet WxApp.dll --urls http://0.0.0.0:5117 ;#要执行的命令
directory=/home/wwwroot/txwxh-mh.lw-i.com.cn/ ;#命令执行的目录
environment=ASPNETCORE_ENVIRONMENT=Production ;#环境变量
user=root ;#进程执行的用户身份
stopsignal=INT
autostart=true ;#是否自动启动
autorestart=true ;#是否自动重启
startsecs=1 ;#自动重启间隔
stderr_logfile=/var/log/supervisor/txwxh-mh.lw-i.com.cn.err.log ;#标准错误日志
stdout_logfile=/var/log/supervisor/txwxh-mh.lw-i.com.cn.log ;#标准输出日志

6、supervisor命令

supervisorctl -u user -p 123 -c /etc/supervisor/supervisord.conf shutdown

supervisord -c /etc/supervisor/supervisord.conf

7、ubuntu允许端口通过防火墙

sudo ufw allow 端口号

8、ubuntu系统安装字体

        ubuntu的系统字体放在目录:/usr/share/fonts/truetype下,到这个文件夹下创建一个文件夹,然后将字体放在刚创建的目录下,然后更新字体缓存,以便系统能够识别新安装的字体。

fc-cache -fv

9、ubuntu设置免密码sudo操作

        使用sudo visudo命令编辑sudoers文件可以确保语法正确,避免编辑错误导致的问题。

# Members of the admin group may gain root privileges
%admin ALL=(ALL) NOPASSWD: ALL# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) NOPASSWD:ALL

10、nginx部署vue

        安装nginx

sudo apt update
sudo apt install nginx

        编辑配置文件, 这里是直接编辑主配置文件/etc/nginx/nginx.conf

        下面是一个基本示例,需要添加到http块内使用

server {listen 80;server_name your_domain.com; # 替换为你的域名或IP地址location / {root /usr/share/nginx/html; # 根据你的dist目录位置进行调整try_files $uri $uri/ /index.html; # 处理前端路由}# 根据你的后台服务进行反向代理配置location /prod-api/{proxy_set_header Host $http_host;proxy_set_header X-Real-IP $remote_addr;proxy_set_header REMOTE-HOST $remote_addr;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_pass http://192.168.10.111:8080; #设置后端服务的地址和端口}error_page 404 /404.html;location = /404.html {internal;}
}

11、ubuntu更换源

        首先备份

sudo cp  /etc/apt/sources.list /etc/apt/sources.list.bak

        编辑文件

sudo vim /etc/apt/sources.list

        这里用清华的源为例

ubuntu | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

        在里面选择符合你自己的Ubuntu版本,这里以20.04为例:

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

        将上面这段全部复制到sources.list中,然后

sudo apt update

        如果还是有问题,可以尝试把https全部改成http。

12、查看Nvidia驱动

nvidia-smi


http://www.mrgr.cn/news/59485.html

相关文章:

  • C++——输入3个整数,按由小到大的顺序输出。用指针或引用方法处理
  • spark读取parquet文件
  • 间接寻址、基址寻址、相对寻址和变址寻址
  • vue3打开弹窗逻辑梳理
  • [LeetCode] 494. 目标和
  • 【C++】—掌握STL string类:字符串操作的得力助手
  • cookie 简介
  • GEE app:全球油棕,橡胶,其他树木,灌木,裸地,水的可视化界面
  • 基于STM32F103的FreeRTOS系列拓展·内存管理
  • 微信好友智能管理神器:微动RPA,重塑私域流量构建新纪元 批量自动添加好友
  • 说一说QWidget
  • 如何从iconfont中获取字体图标并应用到微信小程序中去?
  • 深入理解 Java 中的抽象类
  • 数组和指针复习
  • 为什么说 zsh 是 shell 中的极品?
  • 地球村上一些可能有助于赚钱的20个思维方式
  • 虚拟机上创建的网站在真机上无法访问的解决办法,以及hosts文件编辑的解决办法
  • 5.15 加载内核映像文件(1)
  • 单目深度估计评价指标及其含义说明
  • 线程同步(互斥锁条件变量)
  • 中药大数据(三)中医知识图谱的创建
  • 面向对象高级-static
  • Web大学生网页作业成品——动漫喜羊羊网页设计与实现(HTML+CSS)(4个页面)
  • MicroServer Gen8再玩 OCP万兆光口+IT直通之二
  • pandas习题 024:用字典构造 DataFrame
  • 在GeoTools中的Shapefile属性表读取效率之Shp与Dbf对比