• 查看linux主机已安装的服务


    当前系统版本

    下面的方法可能不适用于所有系统,目前在centos 7上试用

    [root@localhost ~]# cat /etc/os-release 
    NAME="CentOS Linux"
    VERSION="7 (Core)"
    ID="centos"
    ID_LIKE="rhel fedora"
    VERSION_ID="7"
    PRETTY_NAME="CentOS Linux 7 (Core)"
    .....
    REDHAT_SUPPORT_PRODUCT_VERSION="7"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9

    可使用查看已安装服务器或已启动服务的命令

    systemctl list-unit-files

    [root@localhost ~]# systemctl list-unit-files
    UNIT FILE                                     STATE   
    proc-sys-fs-binfmt_misc.automount             static  
    dev-hugepages.mount                           static  
    dev-mqueue.mount                              static  
    proc-sys-fs-binfmt_misc.mount                 static  
    sys-fs-fuse-connections.mount                 static  
    sys-kernel-config.mount                       static  
    sys-kernel-debug.mount                        static  
    tmp.mount                                     disabled
    brandbot.path                                 disabled
    systemd-ask-password-console.path             static  
    systemd-ask-password-plymouth.path            static  
    systemd-ask-password-wall.path                static  
    session-2.scope                               static  
    arp-ethers.service                            disabled
    auditd.service                                enabled 
    autovt@.service                               enabled 
    blk-availability.service                      disabled
    .......
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20

    netstat -aultp 已启动服务

    [root@localhost ~]# netstat -aultp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN      1168/sshd           
    tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN      1521/master         
    tcp        0     52 localhost.localdoma:ssh 192.168.0.154:31672     ESTABLISHED 1802/sshd: root@pts 
    tcp6       0      0 [::]:ssh                [::]:*                  LISTEN      1168/sshd           
    tcp6       0      0 localhost:smtp          [::]:*                  LISTEN      1521/master         
    udp        0      0 0.0.0.0:bootpc          0.0.0.0:*                           1727/dhclient       
    udp        0      0 localhost:323           0.0.0.0:*                           870/chronyd         
    udp6       0      0 localhost:323           [::]:*                              870/chronyd  
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11

    cat /etc/services 所有服务

    cat /etc/services
    monetra-admin   8666/tcp                # Monetra Administrative
    msi-cps-rm      8675/tcp                # Programming Software for Radio Management Motorola Solutions Customer
    msi-cps-rm-disc 8675/udp                # Programming Software for Radio Management Discovery
    sun-as-jmxrmi   8686/tcp                # Sun App Server - JMX/RMI
    sun-as-jmxrmi   8686/udp                # Sun App Server - JMX/RMI
    openremote-ctrl 8688/tcp                # OpenRemote Controller
    vnyx            8699/tcp                # VNYX Primary Port
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    yum list installed 已安装包

    其他命令作用:
    yum针对软件包操作常用命令
    使用 yum 查找软件包
    命令:yum search
    列出所有可安装的软件包
    命令:yum list
    列出所有可更新的软件包
    命令:yum list updates
    列出所有已安装的软件包
    命令:yum list installed

  • 相关阅读:
    java计算机毕业设计springboot+vue基本微信的大学生竞赛报名小程序
    26.cuBLAS开发指南中文版--cuBLAS中的Level-2函数syr()
    Windows系统下有英伟达显卡安装PyTorch
    day04 spring 声明式事务
    Shopee做关键词广告要选择什么样的产品?
    java_网路爬虫_1
    jvm-java 内存模型 以及各个分区具体内容
    【微服务38】分布式事务Seata源码解析六:全局/分支事务分布式ID如何生成?序列号超了怎么办?时钟回拨问题如何处理?
    CTFHub-SSRF-读取伪协议
    ESP32 Arduino实战基础篇-使用 ADC 读取模拟值
  • 原文地址:https://blog.csdn.net/wsuyixing/article/details/126771995