Linux服务状态的基本查询

1,linux查看基于redhat服务器的系统版本

     cat /etc/redhat-release

 

2,linux查看服务器的查看硬盘和分区分布

[root@hadoop01 ~]# lsblk
NAME                MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                   8:0    0 931.5G  0 disk 
├─sda1                8:1    0   102M  0 part 
├─sda2                8:2    0     2G  0 part 
├─sda3                8:3    0   500M  0 part 
├─sda4                8:4    0     1K  0 part 
└─sda5                8:5    0 928.9G  0 part 
  ├─centos-swap     253:2    0   7.9G  0 lvm  
  ├─centos-home     253:3    0   871G  0 lvm  
  └─centos-root     253:4    0    50G  0 lvm  
sdb                   8:16   0 931.5G  0 disk 
├─sdb1                8:17   0   953M  0 part /boot
└─sdb2                8:18   0 930.6G  0 part 
  ├─centos00-root00 253:0    0  93.1G  0 lvm  /
  ├─centos00-swap   253:1    0   3.7G  0 lvm  [SWAP]
  └─centos00-home   253:5    0 833.7G  0 lvm  /home
sr0                  11:0    1  1024M  0 rom  

3,linux查看服务器硬盘和分区的详细信息

[root@hadoop01 ~]# fdisk -l


Disk /dev/sda: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x59776113


   Device Boot      Start         End      Blocks   Id  System
/dev/sda1              63      208844      104391   de  Dell Utility
/dev/sda2   *      208896     4403199     2097152    c  W95 FAT32 (LBA)
/dev/sda3         4403200     5427199      512000   83  Linux
/dev/sda4         5427200  1953523711   974048256    5  Extended
/dev/sda5         5429248  1953523711   974047232   8e  Linux LVM


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000be30e


   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *        2048     1953791      975872   83  Linux
/dev/sdb2         1953792  1953523711   975784960   8e  Linux LVM


Disk /dev/mapper/centos00-root00: 100.0 GB, 100000595968 bytes, 195313664 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes




Disk /dev/mapper/centos00-swap: 4001 MB, 4001366016 bytes, 7815168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes




Disk /dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes




Disk /dev/mapper/centos-home: 935.2 GB, 935212351488 bytes, 1826586624 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes




Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes




Disk /dev/mapper/centos00-home: 895.2 GB, 895198691328 bytes, 1748434944 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

4,linux查看服务器的存储资源使用率

[root@hadoop01 ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/centos00-root00   92G   14G   74G  16% /
devtmpfs                     3.8G     0  3.8G   0% /dev
tmpfs                        3.8G     0  3.8G   0% /dev/shm
tmpfs                        3.8G  8.6M  3.8G   1% /run
tmpfs                        3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sdb1                    922M  101M  758M  12% /boot
/dev/mapper/centos00-home    821G   53G  726G   7% /home
tmpfs                        779M     0  779M   0% /run/user/0

5,linux查看服务器的内存的大小和内存使用情况

[root@hadoop01 ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           7.6G        1.8G        2.0G        8.6M        3.8G        5.5G
Swap:          3.7G          0B        3.7G


在第一部分Mem 行中有如下参数:
* total: 内存总数,即7.6G
* used: 已经使用的内存数,即 1.8G
* free: 空闲的内存数:即 2.0G
* shared:当前已废弃不用,总是 8.6M
* buff/cache: 缓存内存数,即 3.8G
* available: 可用的内存数,即 5.5G


第二部分指交换分区

或者是

[root@hadoop01 ~]# cat /proc/meminfo | grep MemTotal
MemTotal:        7968764 kB //8G

7,linux查看CPU的个数和核数

[root@hadoop01 ~]# cat /proc/cpuinfo | grep "physical id" | uniq | wc -l
1
[root@hadoop01 ~]# cat /proc/cpuinfo |grep "cores"|uniq 
cpu cores	: 4

8,linux查看端口的使用情况

[root@hadoop01 ~]# netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN     
tcp        0      0 192.168.5.221:8019      0.0.0.0:*               LISTEN     
tcp        0      0 192.168.5.221:8020      0.0.0.0:*               LISTEN     
tcp        0      0 192.168.5.221:50070     0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50010           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50075           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8480            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:50020           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:8485            0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:46279         0.0.0.0:*               LISTEN     
tcp6       0      0 :::8040                 :::*                    LISTEN     
tcp6       0      0 :::8042                 :::*                    LISTEN     
tcp6       0      0 192.168.5.221:3888      :::*                    LISTEN     
tcp6       0      0 :::60150                :::*                    LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
tcp6       0      0 192.168.5.221:8088      :::*                    LISTEN     
tcp6       0      0 :::49337                :::*                    LISTEN     
tcp6       0      0 ::1:25                  :::*                    LISTEN     
tcp6       0      0 :::13562                :::*                    LISTEN     
tcp6       0      0 192.168.5.221:8030      :::*                    LISTEN     
tcp6       0      0 192.168.5.221:8031      :::*                    LISTEN     
tcp6       0      0 192.168.5.221:8032      :::*                    LISTEN     
tcp6       0      0 192.168.5.221:8033      :::*                    LISTEN     
tcp6       0      0 :::2181                 :::*                    LISTEN    

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值