美文网首页生物信息学与算法
Linux 基础回顾及运行环境检查

Linux 基础回顾及运行环境检查

作者: BohanL | 来源:发表于2019-08-01 19:00 被阅读1次

    网络检查:

    ping www.163.com    #使用PING命令检查外网链接情况
    

    查看当前网络运行环境

    netstat -nr    #打印当前路由表
    
    Kernel IP routing table
    Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
    0.0.0.0         10.75.119.1     0.0.0.0         UG        0 0          0 enp134s0f0
    10.75.116.0     0.0.0.0         255.255.252.0   U         0 0          0 enp134s0f0
    12.12.12.0      0.0.0.0         255.255.255.0   U         0 0          0 ib0
    169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eno1
    169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp134s0f0
    169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 ib0
    172.16.10.0     0.0.0.0         255.255.255.0   U         0 0          0 eno1
    172.16.20.0     0.0.0.0         255.255.255.0   U         0 0          0 eno1
    
    ifconfig    #显示当前内核网络接口的工作状态
    
    eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.16.10.200  netmask 255.255.255.0  broadcast 172.16.10.255
            inet6 fe80::a94:efff:fe70:4eb3  prefixlen 64  scopeid 0x20<link>
            ether 08:94:ef:70:4e:b3  txqueuelen 1000  (Ethernet)
            RX packets 1582654868  bytes 305433476235 (284.4 GiB)
            RX errors 0  dropped 47810958  overruns 0  frame 0
            TX packets 190138297  bytes 34977293520 (32.5 GiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eno1:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.16.20.200  netmask 255.255.255.0  broadcast 172.16.20.255
            ether 08:94:ef:70:4e:b3  txqueuelen 1000  (Ethernet)
    
    enp134s0f0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 10.75.119.206  netmask 255.255.252.0  broadcast 10.75.119.255
            inet6 fe80::a236:9fff:fe20:9fb8  prefixlen 64  scopeid 0x20<link>
            ether a0:36:9f:20:9f:b8  txqueuelen 1000  (Ethernet)
            RX packets 16110972352  bytes 17710866791280 (16.1 TiB)
            RX errors 0  dropped 47810919  overruns 0  frame 0
            TX packets 7315734650  bytes 3290896593864 (2.9 TiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    

    系统环境检查:

    lsb_release -a     #列出当前系统及内核版本信息
    
    LSB Version:    :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
    Distributor ID: CentOS
    Description:    CentOS Linux release 7.4.1708 (Core)
    Release:        7.4.1708
    Codename:       Core 
    

    软件包安装检查:

    Ubuntu系统:

    apt list --installed    #查看所有安装的包
    

    Debian系统:

    dpkg-query -l    #查看所有安装的包
    

    CentOS系统:

    rpm -qa #查看所有安装的包
    rpm -qa | grep ???  #查看???包是否在已安装列表并返回
    

    Ubuntu软件源列表查看

    cd /etc/apt/    #访问/etc/apt/ 文件夹
    vi sources.list #查看目前的软件源列表
    esc :q! #不保存退出 Ubuntu
    

    软件源列表修改

    可以使用如下命令:

    sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list        #将默认的源地址[http://archive.ubuntu.com/](http://archive.ubuntu.com/) 替换为 [http://mirrors.ustc.edu.cn](http://mirrors.ustc.edu.cn/)
    sudo apt-get update  
    

    Linux环境变量查看/修改

    环境变量的查看

    按变量的生存周期来划分,Linux变量可分为两类:

    1 永久的:需要修改配置文件,变量永久生效。

    2 临时的:使用export命令声明即可,变量在关闭shell时失效。

    nohup相关

    nohup python -utry.py &>nohup.out&        #将屏幕输出实时加入nohup.out文件
    tail -fn 50 nohup.out             #查看最近50行输出内容
    

    相关文章

      网友评论

        本文标题:Linux 基础回顾及运行环境检查

        本文链接:https://www.haomeiwen.com/subject/fugcdctx.html