zoukankan      html  css  js  c++  java
  • linux

    linux

    版本信息:
    lsb_release
    /etc/lsb-release

    主机名配置:
    hostname #查看主机名
    hostnamectl
    hostnamectl status
    hostnamectl set-hostname

    /etc/hosts #修改host文件

    网络配置:
    nmcli #查看端口
    nmcli device
    nmcli connection
    nmcli c add type ethernet con-name ens192 ifname ens192 ipv4.addr 10.10.10.22/24 ipv4.gateway 10.10.10.1 ipv4.method manual
    #静态ip
    nmcli con mod ens192 ipv4.dns "10.10.10.1"
    nmcli con up ens192

    nmcli c add type ethernet con-name ethX ifname ethX ipv4.method auto #动态ip
    nmcli c delete #删除连接

    DNS:
    /etc/resolv.conf

    ubuntu:
    netplan
    /etc/netplan/00-installer-config.yaml


    selinux:
    /etc/selinux/config
    sestatus #查看selinux状态
    getenforce

    setenforce 0 #关闭selinux
    SELINUX=disabled #永久关闭


    存储配置:
    fdisk -l
    df -h
    lvm

    用户管理:
    /usr/share/doc/setup*/uidgid
    /etc/login.defs

    groupadd -g 1000 tim
    useradd -g tim -u 1000 tim

    sudo:
    visudo命令: /etc/sudoers
    root ALL=(ALL) ALL
    tim ALL=(ALL) ALL

    %sudo ALL=(ALL:ALL) NOPASSWD:ALL


    alias:
    .bashrc


    软件包管理:
    rpm 命令
    rpm –ivh <package_name> #安装
    rpm –e <package_name> #卸载
    rpm qa|grep vi #查询是否安装
    rpm -qf /usr/bin/vi #查询拥有指定文件的套件
    rpm -qif /usr/bin/vi #查询指定文件的包信息

    dnf 命令
    dnf install <package_name> #安装
    dnf remove <package_name> #卸载
    dnf search <pkg_name> #搜索相关软件
    dnf list #列出所有

    dnf list installed #列出安装
    dnf grouplist #列出软件组
    dnf repolist -v #列出repo信息
    dnf info package #显示包信息
    dnf provides *filename* #列出包含指定文件的包
    dnf clean all # 清除所有的缓存文件
    dnf makecache # 生成元数据缓存

    dnf update #更新索引文件
    dnf upgrade #更新软件

    ubuntu:
    apt
    /etc/apt/sources.list


    服务管理:
    /etc/systemd/system/
    /usr/lib/systemd/system

    nginx.service
    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs/
    After=network.target remote-fs.target nss-lookup.target

    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target

    systemctl daemon-reload #重新加载服务
    systemctl list-units --type=service #查看所有已启动的服务
    systemctl status nginx.service #查看服务当前状态

    systemctl start nginx.service #启动nginx服务
    systemctl stop nginx.service #停止nginx服务
    systemctl restart nginx.service #重新启动服务

    systemctl enable nginx.service #设置开机自启动
    systemctl disable nginx.service #停止开机自启动


    开发工具包组:
    centos
    build-essential #ubuntu
    Development Tools #centos

  • 相关阅读:
    随机生成密码
    vue 仿新闻项目笔记
    vuex 随笔
    SourceTree
    vue npm,Git随笔
    谷歌浏览器如何去掉自动填充的背景色
    hold 命令
    ind2vec和vec2ind函数
    稀疏矩阵(sparse matrix)
    第五篇 学习OpenCV之视频处理
  • 原文地址:https://www.cnblogs.com/timlong/p/4977027.html
Copyright © 2011-2022 走看看